Hello World!!


Hello World


   class HelloWorld
   {
    public static void main(String args[])
    {
    System.out.println("Hello, World!");
    }
   }



If all goes well, you should see the following output:

Hello, World!

Explaination:



  • All code is contained within a class, in this case HelloWorld.
  • The file name must match the class name and have a .java extension, for example: HelloWorld.java.
  • All executable statements are contained within a method, in this case named main().
  • Use System.out.println() to print text to the terminal.
Note:
  • Classes and methods (including other flow-control structures) are always defined in blocks of code enclosed by curly braces { }.
  • All other statements are terminated with a semi-colon (;).
  • Java language is case-sensitive! This means that HelloWorld is not the same as helloworld, nor is String the same as string.




Popular posts from this blog

Naming Conventions

if..else..if Loader

Nested if..else Statement