Java Part 4 : Hello World!

This article will show you how to execute the first Java program. At first you should get to know few terms related to java programming.


Java Comments

Java comments are used to provide information and explanations to the code you develop. These comments are not executable and added in the program to get a clear understanding about the code.


There are different types of java comments and you will  get to know about them in upcoming articles .


package myproject

Java Package contain one or more Java files. In here contents of the file MyProject.java belongs to the package myproject  


public class MyProject


Java File contains only one class and the class name should always match with the file name.


An error will be generated if the package name does not match with the file name.




Note : Java is a case sensitive Language


public static void main(String[] args)

To run a class there should be a special behavior.  In here main is the behavior which helps to execute the program.


There are 3 different characteristics in this main.
      1. public  
      2. static
      3. void
(String[] args ) include set of arguments. The main method executed when you run your program.So you can type your program in the main.



I have typed the statement to print Hello World! in the main method.Run the program by clicking the Run Button in the top.
System.out.print() is used to type a print statement. The generated Output is shown in the image given below.








Comments