1.3 Creating your first program in Java
All Java programs usually start out as text files, which are then used to create “class” files, which in turn are actually executable programs. This means that Java programs can be written in any basic text editor, such as Notepad. Follow these steps to create a simple Java program that displays a traditional greeting.
1.Open a basic text editor, for example, Notepad and type the following code in it exactly as here – you will create a class named Hello. class Hello {}
2.Between the two curly braces of the Hello class, insert the following code to create the main method of the Hello class. public static void main (String [] args) {}
3.Between the curly braces of the main method, add the following line of code that defines what the program will do. System.out.println (“Hello World!”);
4.Save the file in any convenient place and name it exactly like this: Hello.java – the finished program now looks like this: