How to run java program in eclipse

   Run your first java program with eclilpse IDE

         In java everything is class and objects. In the previous post we have discussed about
how to create  a object. In our general life, we need a start point to start with. For example, if we are opening this site, we need to click a link or type the url http://javaonlinehub.blogspot.com.The user who is typing the url is the starter. Likewise someone has to start the java program and execute the functions.That someone is the JVM[ we already discussed  about JVM] .JVM  will call the main function.Main function will  be the starting point of  java program. Main function needs to be written  inside the class as in java everything should be inside class.

Please note that   "//"   is to mention the comments

package Sample;

 public class Sampleclass {

public static void main(String args[]){     // will discuss about static  and void in upcoming posts

System.out.println("My first java program-- java online hub you tube channel");

}

 }


         Output : My first java program-- java online hub you tube channel


       View the below video tutorial for the demo using eclipse

     

Previous
Next Post »