Java tutorial- first program

Write your first program with Java



Now open text editor (e.g. Notepad) and type the following code:

public class HelloWord
{
   public static void main(String[] args)
   {
      System.out.println("Hello World");
   }
}

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.


create the first project in Eclipse

-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.


create a new class in Eclipse

-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.


public class HelloWorld {

}

You can copy and paste the Java code shown above to override this code block. Now you are ready to run the program.



Comments

Name:
Comment:
Enter the text:
CAPTCHA image

....................................................................................................................Home | Forum | About | Contact
This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.
Copyright @ 2011-2013 worldbestlearningcenter. All Rights Reserved.
Home Programming Web DB & App Questions Exercises Tips Programs FAQs Download About
Computer-Wbest
Popular Pages
You might like