-
Notifications
You must be signed in to change notification settings - Fork 10
Assignment 0
yoavg edited this page Mar 10, 2017
·
1 revision
Install the Java Development Kit. (JDK) Download the installation file from here and run it.
Open up a terminal window, and issue the following commands:
java -version
javac -version
You should see output similar to:
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) Server VM (build 24.51-b03, mixed mode)
and
javac 1.7.0_51
- Create a file named
HelloWorld.java - Enter the following content:
public class HelloWorld {
public static void main(String[] args) {
for (int i = 0; i < 5; i++) {
System.out.println("Hi");
}
}
}- Compile the program using:
javac HelloWorld.java - Verify that a corresponding
HelloWorld.classfile is created. - Run the compiled program:
java HelloWorld
You should see the output
Hi
Hi
Hi
Hi
Hi
Read and follow the instructions in the CodingStyle page.