#4 First JAVA program

My first Java program



Open your text editor and type the following lines of code:


/* My first program Version 1 */

 public class Example1 { public static void main (String args [])

{
System.out.println ("My first Java program");
}
 }


Save the file as Example1.java2. The name of the program has to be similar to the filename. Programs are called classes. Please note that Java is case-sensitive. You cannot name a file “Example.java” and then in the program you write “public class example”. It is good practice to insert comments at the start of a program to help you as a programmer understand quickly what the particular program is all about. This is done by typing “/*” at the start of the comment and “*/” when you finish.

Comments

Popular Posts