Requirements for java Program

  1. Install the JDK any version if you don’t have installed it.
  2. Set path of the jdk/bin directory.
  3. Create the java program.
  4. Compile and run the java program. 


Refer this link to Download & Install JAVA:   Java | Download Install and Setup.


Simple Java Program



Understanding first java program


Meaning of packageclass, public, static, void, main, String[], System.out.println():


  • package Using package statement defines a namespace in which number of classes are stored. The package is used to organize the classes based on functionality and workflow. It must be the primary line of your program is package name.
  • class keyword is used to declare a class with class name in java.
  • Comments (//) Single line starts with two forward slashes (//) and continues to the end of the current line. Line comments do not require an ending symbol.
  • public keyword is an access modifier which represents visibility, it means it is visible to all. Depends on Datatype, Method, Class Visibility.
  • static keyword, if we declare any method as static, it is known as static method. The core advantage of static method is that there is no need to create object to invoke the static method. The main method is executed by the JVM, so it doesn’t require to create object to invoke the main method. So it saves memory. Using static keyword directly use functionality without object creation.
  • void is the return type of the method, it means it doesn’t return any value. Does not return any Data type.
  • main represents startup of the program. Main Execution method of Program.
  • String[] args is used for command line argument. Give command to Console.
  • System.out.println() is used print statement with / without message.