CMPT 125/6 Lab 1

This lab is designed primarily to get you used to working with the Java tools.

  1. In the Crimson Editor (or another text editor), create a Java program named hello.java that prints the words "Hello world" on the screen. You might want to look at the example code.

    Save this program on your H: drive. Start the “Java Console”. Compile the program with the command javac hello.java. Then run the program with java ClassName.

  2. Start JCreator LE and create a Java program named hello2.java that prints the words "Hello world" on the screen. Again, you can work with at the example code.

    Compile and run the program in JCreator.

  3. Write a Java program that determines if a number is even or odd. Name the file parity.java.

    The program should output either “The number is even” or “The number is odd”, as appropriate. You can use a number that is initialized into an appropriate variable. The % operator in Java is remainder/modulus.

This lab must be completed in the lab and will be marked then by the TA.