Students who complete this lab will demonstrate that they can:

Java Development Environments

One advantage of moving to the full Java platform is the availability of more powerful development environments. You will use one of the following for the remainder of your labs and homeworks:

Exercise 6.1

If you haven't already done so, use your Java IDE to do the following:

  1. Create a project for your Java-based lab and homework exercises for this course.
  2. Create a new package for this lab exercise named edu.calvin.yourLoginID.lab06 . (Be sure to replace yourLoginID with your unique value).

Use this package for all the exercises in this lab. Take time now to make sure that you can find the package/directory you just created; you will submit this package/directory in same way that you submitted your work for Processing.

You can find a full Java API documentation here: http://docs.oracle.com/javase/7/docs/api/.

Console-Based Java Applications

All the Processing-based applications in this course have been graphically oriented, but Java also supports command-line or console-based applications that read input that the user types on the keyboard and print their output on the textual console. We will not build many console-based applications, but it’s useful to see how they work.

You build a Java program by creating a new Java class with a main() method; you can then run this class as a Java application. To create the class in eclipse, right-click on the package where you want to place the class (in this case, edu.calvin.yourLoginID.lab06 ) and choose "New"-"Class".

Exercise 6.2

Use your Java IDE to build a simple, console-based Java application that reads in a person’s name and prints out a friendly welcome. Call your program class Hello . It should implement this, exceedingly simple, algorithm:

  1. Prompt for the user’s name.
  2. Print a friendly message that includes the user’s name.

Here is an example run:

Please enter your name: Rembrandt
Welcome, Rembrandt!

Here, the user typed Rembrandt following the prompt. Save this program using your Java IDE.

You’ll find the the file under Eclipse’s src directories under a series of directories in directories that match the package name you gave to the program, as in:


Checking In

Submit the directory lab06 and the code file Hello.java contained within. We will grade this exercise according to the following criteria: