class FirstJavaProgram{
public static void main(String args[]){
System.out.println(" Welcome to Java Tutorial");
}
}
save this file name as FisrtJavaProgram.java
Lets explain this program
class keyword is used to declare a class in java.
public keyword is an acess modifier which represent visibility, it means it is visible to all.
static is a keyword, if we declare any method as static, it is known as static. The main method is executed by the JVM.
void is return type of method, it means it does not return any value.
main is a entry point of the program. Execution of program starts from main. it is called Runtime System.
String[]args is used for command line argument.
system.out.println() is used to print statement.
How to Run java Program
To Compile: javac FirstJavaProgram.java
To Execute: Java FirstJavaProgram
OUTPUT: Welcome to Java Tutorial
public static void main(String args[]){
System.out.println(" Welcome to Java Tutorial");
}
}
save this file name as FisrtJavaProgram.java
Lets explain this program
class keyword is used to declare a class in java.
public keyword is an acess modifier which represent visibility, it means it is visible to all.
static is a keyword, if we declare any method as static, it is known as static. The main method is executed by the JVM.
void is return type of method, it means it does not return any value.
main is a entry point of the program. Execution of program starts from main. it is called Runtime System.
String[]args is used for command line argument.
system.out.println() is used to print statement.
How to Run java Program
To Compile: javac FirstJavaProgram.java
To Execute: Java FirstJavaProgram
OUTPUT: Welcome to Java Tutorial
No comments:
Post a Comment