1. Compile (javac) and run (java)

  • Java programs: compile using javac command, run using java command (virtual machine)

    • Java source code developed by the programmer

      • Typically created using a text editor (e.g. Geany) or an Integrated Development Environment (e.g. Netbeans)

    • Bytecode (generated by the compiler for JVM to read and interpret)

      • Can be viewed using javap -c Welcome.class

    • “Welcome to Java” is displayed on the console

Java program-development process
Figure 1. The Java program-development process consists of repeatedly creating/modifying source code, compiling, and executing programs.[1];

2. Welcome

  • Demonstrate Welcome.java and explain:

    • class name and the file name

    • main method

    • String

    • statement terminator ;

    • reserved words: class, public, static, void

    • line/block comment

    • blocks beginning with { and ending with }

    • case sensitivity (e.g. main)

3. Computers can compute

4. Programming is (sometimes) dealing with errors

5. Exercises

  • Practical work assignments: from Chapter 1: 1.1, 1.3, 1.7, 1.9, 1.11


1. Liang, Y Daniel. Intro to Java Programming, Comprehensive Version, Global Edition, 10th Edition. Pearson (Intl), 11/2014. VitalBook file.