• Next step will be to create HelloWorld.java file. Navigate to File/New/Class.

Image showing the creation of new Java Class file under Java Project

 

  • On selecting class option you see New Java Class pop-up. Here we will create the HelloWorld.java file with the default package.
  • One of the advantage of using IDE as the development tool is it helps you create code skeleton and comments, so you can spend your precious time doing other important things in life like fishing, long drives, dating ,etc. Wink

Eclipse image showing the declaration of New Java Class inside HelloWorld Project

 

  • Name (Name of the Java File): HelloWorld
  • Which method stubs would you like to create: Check "public static void main(String[] args)" option.
  • Do you want to add comments?: Check "Generate comments" option.
  • Click Finish to create the HelloWorld.java

Image showing the HelloWorld.java file

  • Now you have the stub of main method created. You are ready to edit the method as per your needs.
    Edit the main method to print "HelloWorld" as shown below.

Image showing the edited HelloWold.java file in Eclipse

 

 

We use cookies

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.