CS2312 Problem Solving and Programming

December, 2013

Prepared/Maintained by Mr. HO Wai Kit (BSC2)

[BACK]

Q1: What is JAVA?

  • Java is a computer programming language that is concurrent, class-based, object-oriented, and specifically designed to have as few implementation dependencies as possible.
  • Sun Microsystems released the first public implementation as Java 1.0 in 1995. It promised "Write Once, Run Anywhere" (WORA), providing no-cost run-times on popular platforms. Oracle Corporation is the current owner of the official implementation of the Java SE platform now.
  • Open source and free
  • Easy to Use: The fundamentals of Java came from a programming language called c++. Although c++ is a powerful language, it was felt to be too complex in its syntax, and inadequate for all of Java's requirements. Java built on, and improved the ideas of c++, to provide a programming language that was powerful and simple to use.
  • Reliability: Java needed to reduce the likelihood of fatal errors from programmer mistakes. With this in mind, object-oriented programming was introduced. Once data and its manipulation were packaged together in one place, it increased Java’s robustness.
  • Secure: As Java was originally targeting mobile devices that would be exchanging data over networks, it was built to include a high level of security. Java is probably the most secure programming language to date.
  • Platform Independent: Programs needed to work regardless of the machine they were being executed on. Java was written to be a portable language that doesn't care about the operating system or the hardware of the computer.
  • What is Java SE, Java EE, Java ME ?
    • Java SE: Java Platform Standard Edition
    • Java EE: Java Platform Enterprise Edition
    • Java ME: Java Platform Micro Edition
  • Reference: Wiki   Java About

Q2: How to install JDK and Eclipse for Java Programming ?

  • For the Java development, you basically need 2 things - Java development Kit (JDK) and integrated development environment (IDE). The Java Development Kit (JDK) is an implementation of either one of the Java SE, Java EE or Java ME platforms. It includes "tools for developing, debugging, and monitoring Java applications. The JDK also comes with a complete Java Runtime Environment (JRE), usually called a private runtime, due to the fact that it is separated from the "regular" JRE and has extra contents. It consists of a Java Virtual Machine (JVM) and all of the class libraries present in the production environment, as well as additional libraries only useful to developers
    There are many different open source integrated development environment (IDE) for the java development. The most famous one is Eclipse. Eclipse is open source and free that provides different version for different java development environment.
  • i. Search "java se" in google
    ii. Go to Oracle site to download the JDK, the latest one is 7u45
    iii. Choose the suitable set up file
    iv. Install the JDK
    v. Continue the next step
    vi. Installation of JRE
    vii. Complete the installation of JDK
    viii. Go to System
    ix. Select the Advanced tab
    xi. Click Environment Variables
    xii. In the section System Variables. Find the PATH environment variable and select it. Click Edit
    xiii. Find out the Java folder in "Program files". Copy the path.
    xiv. Use ";" to separate each environment setting, paste the path at the last. Remember to use ";" in the end
    xv. Open CMD. Check with "java -version" and "javac -version". You will get the message the same as the image
  • i. Search "eclipse" in google
    ii. Go to Eclipse site and click the download
    iii. There are different versions for different java development environment. Select the standard one.
    iv. You can select download link from different location
    v. Save the zip file
    vi. After you download it, extract the zip file
    vii. Eclipse doesn't need any installation, it's portable software.
    viii. Suggestion: Put the eclipse folder into the C:\
    ix. Suggestion: Create desktop shortcut
    x. Run the eclipse
    xi. It will ask you the workspace (Project location) when you run the eclipse
  • i. Welcome page
    ii. Different working area in eclipse
    iii. Create first project
    iv. Type the project name
    v. Project directory
    vi. Create class
    vii. Type the class name (same as the java file name), check the "main" method
    ix. Run the "Hello World" program

Q3: History of Java books and references

  1. Core Java. Volume I. Fundamentals, 8th Edition (Highly Recommended) Link 1 Link 2
    ISBN-10: 0132354764 | ISBN-13: 978-0132354769
  2. The Unified Software Development Process Link 1
    ISBN-10: 0201571692 | ISBN-13: 978-0201571691
  3. Design Patterns: Elements of Reusable Object-Oriented Software (Highly Recommended) Link 1 Link 2
    ISBN-10: 0201633612 | ISBN-13: 978-0201633610

Q4: Useful sites

  1. Java Offical SE7 API document: Java SE 7 API doc
  2. Highly Recommend: Tutorial Points
    This is a highly recommended site to learn different programming language, framework, software design and provides many examples. You can learn it from basic Java syntax, primitive Data Types, logical operation, decision making, different Java API, different object oriented programming skill (Encapsulation, Inheritance, Overloading, Polymorphism ...) and design pattern (Singleton pattern, Adaptor pattern, Factory pattern, Command pattern, MVC pattern ...).
  3. Highly Recommend: Java Fundamental
    The other highly recommended site that provides many details than tutorialpoints.com.If you are the new beginner of java, you should follow the table of content to learn from the basic syntax. Each topic includes many different examples.
  4. Java Dictionary: Java2s
  5. Java Online Complier: Compile Online Learn Java Online
    Interesting java online complier, you can practice programming or do some small console application. And the source code can be download from the site after you complete it. And the site also provides any other complier for different programming language.Interesting java online complier, you can practice programming or do some small console application. And the source code can be download from the site after you complete it. And the site also provides any other complier for different programming language.
  6. Java User Interface Application Development:
    Java API provides two package - java.awt and javax.swing for developing desktop graphical user interface application. Prior to Java 6 Update 12, mixing Swing components and basic AWT widgets often resulted in undesired side effects, with AWT widgets appearing on top of the Swing widgets regardless of their defined z-order. This problem was because the rendering architecture of the two widget toolkits was very different, despite Swing borrowing heavyweight top containers from AWT.
    There is a build in tool for developing AWT/Swing User Interface. If your eclipse does not include this tool. You can download here. Window builder Start to use Swing Designer and SWT Designer
  7. OO Design Pattern: Tutorial Points OO Design
  8. Chinese recommended site: Open Home

Q5: UML tools for eclipse

Adding Object Aid UML Diagram in Eclipse: ObjectAid_UML_Explorer_Guide