COMP 215: Lab for Assignment 0


Step 1:


Install the JDK on your machine. See http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1637583.html.


Step 2: 


Install Dr. Java on your machine.  See http://drjava.org/.


Step 3: 


Fire up Dr. Java and create a new project (use Project->New) called "A0.0".


Step 4:


Type in some java code:


class Foo {

  public void doIt (int numTimes) {

    for (int i  = 0; i < numTimes; i++) {

      System.out.println ("This is time number " + (i + 1));

    }

  }

} 


Then save it in a file called "Foo.java" (it is practically required that you save a class in a file of the same name).


Step 5:


Create a new file by pressing the "New" button.  Here you can type in:


class Main {

  public static void main (String [] args) { 

    Foo myFoo = new Foo ()

    myFoo.doIt (6);

  }

}

  

Save this one in a file called "Main.java".


Step 6: 


Hit "Compile Project" to compile your program, then fix the indicated error. Compile it again; it should compile correctly this time. Then hit "Run" to run the project. Show Chris or one of the TAs your output, and then you can leave!