Java-Explanation of First Program



Class Declaration

The first line class Javaapp declares a class, which is an object-oriented construct. Java is a true object-oriented language and therefore, everything must be placed inside a class. class is a keyword and declares that a new class definition follows. Javaapp is a Java identifier that specifies the name of the class to be defined.

Opening Brace

Every class definition in Java begins with an opening brace “{” and ends with a matching closing brace “}“,¬†appearing in the last line in the program.

The main method

The “public static void main(String args[])” defines a method named main. Every Java application program must include the main( ) method. This is starting point for the execution of the program. A Java application can have any number of classes but only one of them must include a main method to initiate the execution.

The Output

The body of the main( ) method consists the statement “System.out.println(“hajsoftutorial”);“. The println( ) method is a member of the out object, which is a data member of System class. This method has been defined so as to display its argument on the Console Screen.

One thought on “Java-Explanation of First Program

Leave a Comment