Introduction: How to Write First Program in JAVA

Picture of How to Write First Program in JAVA

In order to start writing programs in Java, set up your work environment.

Any sort of Notepad-like program will suffice for programming in Java.

Make sure that you have the Java Software Development Kit installed. You will need this for compiling your program.

Lets Start Witting a Java Program

Step 1: In Your Text Editor, Create a New File and Save It As "HelloWorld.java".

Picture of In Your Text Editor, Create a New File and Save It As "HelloWorld.java".

Step 2: Declare Your Class and Your Main Method. the Main Method Public Static Void Main(String[] Args) Is the Method That Will Be Executed When the Programming Is Running.

Picture of Declare Your Class and Your Main Method. the Main Method Public Static Void Main(String[] Args) Is the Method That Will Be Executed When the Programming Is Running.

Step 3: Write the Line of Code That Will Print Out "Hello World."

Picture of Write the Line of Code That Will Print Out "Hello World."

Step 4: Save Your File and Open Up Command Prompt or Terminal to Compile the Program.

Picture of Save Your File and Open Up Command Prompt or Terminal to Compile the Program.

Step 5: Save Your File and Open Up Command Prompt or Terminal to Compile the Program.

Picture of Save Your File and Open Up Command Prompt or Terminal to Compile the Program.

Step 6: Congratulations, You Have Made Your First Java Program!

Picture of Congratulations, You Have Made Your First Java Program!

Comments

About This Instructable

1,617views

16favorites

License:

Bio: Kevin O'Brien and I'm a Software Developer, currently working with It's Your Skills Which is located in Chennai Tamil Nadu.
More by Kevin-O-Brien:How to Write First Program in JAVAJava - Basic Syntax
Add instructable to: