Structure of a Java program
The structure of a java program is very different from traditional programming languages like C or C++. In java we have to declare a class however simple the objective of our program be. This is because java is pure object oriented language. Through difficult to start with, it is clearly one of the best programming paradigms.
Syntax of Java program
public class
{
public static void main (String [] arguments)
{
statemenst;
}
}
Example
Public class myprogClass ------------- Step1
{
Public static void main (String[] arguments) ------------- Step2
{
System.out.println(“Good Morning”); ------------- Step 3
}
}
The above program is inside a file called myprogClass.java
The above program prints Good Morning in the standard output screen
Let us analyze this code step by step
In Step1 we declare a class called myprogClass (We have to declare this)
No comments:
Post a Comment