Friday, December 2, 2016

Write your first Java program

Open the Notepad and type the following code
Save it as “ HelloWorld.java” inside j folder in your D:\ drive.(You can save anywhere you wish to save)
Make sure to use double quotes(“”) or change the save as type into All Files.
Otherwise file extension will be .txt


Compile :
1.Open Command Prompt.
2.Change your directory to “D:\j”

3.Execute the command : javac HelloWorld.java

4.If there is no error, HelloWorld.class file will be created in your folder
5.Finally execute the command:java HelloWorld

Otherwise you can use IDE(Integrated Development Environment) for java development

You can execute above Java program using Eclipse



No comments:

Post a Comment