Java tutorial- first program
Write your first program with Java
Now open text editor (e.g. Notepad) and type the following code:
Then save the code in bin directory (where you installed JDK) with the file name: HelloWord.java.
Note: The file name and the class name must be the same.
If you will use the Eclipse tool to develop your Java programs, you can follow the step below to create your first project.
-Create a project by selecting the New->Java Project from the File menu.
-On the new Java project window, enter the name of the project. For the first program, the project name is HelloWorld.
-Click Finish button to complete the new project set up.
-Create a new class by selecting the New->Class from the File menu. Enter HelloWorld in the Name text box and click finish.
-You will get the HelloWord class block as shown below. At the same time, in the src folder, the HelloWorld.java file is automatically created for you.
You can copy and paste the Java code shown above to override this code block. Now you are ready to run the program.