Test your knowledge!Take a quiz to access yourself.

Hello World of JAVA

The first step of learning any new language is to create a “Hello World” program. Today we are going to explain you how to write Java’s Hello World Program. You just have to know a little bit about Java to write such code and run it. Basics such as What is a project? What is a package? What naming conventions to follow? and few more details…..

Although even if you don’t know any of these and want to give it a try, you can do it by following our tutorial. The only thing you need is to have a environment setup for Java, and an IDE(Integrated development environment) like Eclipse, Netbeans, etc. Our tutorial follows Eclipse as IDE. Just start your Eclipse after environment setup and follow the instructions.

First of all you need to create a Java Project, just go to menu bar and click on  File > New > Other. A new wizard will appear where you can search for the Java Project by writing java in the search box, and then select Java Project and click on next.

 

Next you have to give name to the Project according to the Java’s Naming conventions, and click on next/finish to save it. Now we have a brand new Java Project ready with us, next step is to add a new Package. Now expand your project in Project explorer and right click on src folder and click on New>Package. A wizard will appear, give your package a name following the java’s naming conventions, and save it.

Next is to add a java class into the package which you just created. Right click on package name, and again click on New>Class, give a suitable name to class file again following naming conventions. Then save it.

Now we are going to write our first few lines of code. Important thing to know is that there are shortcuts to write code in eclipse, and one of it is to write your main function by typing main and then pressing ctrl+space and selecting the first suggestion and press an enter. Here comes you main function with full definition. Now in this you can write a simple line of code to display “Hello World”. For that also we have a shortcut, write syso and then again press ctrl+space and then select suitable suggestion and press enter. It gives you a line of code System.out.println();. Now write System.out.println(“Hello World”);. Save it by pressing ctrl+S and run it. Right click on Project name, then go to Run As>Java Application.

And in console there is your Hello World, that’s it you are now a Java Programmer. Keep on learning and keep on sharing. For more just keep on visiting 😉 …..

Add a Comment

Your email address will not be published. Required fields are marked *