Development Of Simple Hello World Java Program

Today we will see how to develop simple Hello world java program. Type the following java program in a notepad and save it in a bin folder of JDK installation directory.
?
1
2
3
4
5
6
7
class Hello
{
     public static void main(String args[])
     {
          System.out.println("Hello World");
     }
}
  • class” is a keyword. Every keyword in java should be in lowercase.
  • Hello” is our class name. First letter of class name should be uppercase. It is not a condition but it is just a convention.
  • public“, “static“, “void” all are keywords.
  • main” is method name. Method name must be in lowercase. “main” method is a special method because execution of any java program starts from “main” method. It takes one argument in the form of String array.  Remember “main” is not a keyword.
  • String is a final class from java.lang package.
  • System” is a final class from java.lang package. “out” is static member of System class of type PrintStream. “println” is a method of PrintStream class.
  • You can explore the source code of both System class and String class. Go to JDK installation directory and extract the ‘src‘ zip file. Then go to src –> java –> lang. In lang folder you will find both System and String Java files.
  • Above program prints “Hello World” on the console.

Comments

Popular posts from this blog

What is string immutability?