*Second tutorial is all about running the*
```First Java Program```
class Simple{
public static void main(String args[]){
System.out.println("Hello Java");
}
}
save this file as
Simple.java
To compile:javac
Simple.java
To execute:java Simple
It will give output as *Hello Java*
```Lets see what this is :```
*class* keyword is used to declare a class in java.
*public* keyword is an access modifier which represents visibility, it means it is visible to all.
*static* is a keyword, if we declare any method as static, it is known as static method. The main method is executed by the JVM, it doesn't require to create object to invoke the main method. So it saves memory.
*void* is the return type of method, it means it doesn't return any value.
*main* is a entry point of the program. Execution of programs starts from main. It is called by Runtime System
*String[] args* is used for command line argument. We will learn it later.
*System.out.println()* is used print statement.
```First Java Program```
class Simple{
public static void main(String args[]){
System.out.println("Hello Java");
}
}
save this file as
Simple.java
To compile:javac
Simple.java
To execute:java Simple
It will give output as *Hello Java*
```Lets see what this is :```
*class* keyword is used to declare a class in java.
*public* keyword is an access modifier which represents visibility, it means it is visible to all.
*static* is a keyword, if we declare any method as static, it is known as static method. The main method is executed by the JVM, it doesn't require to create object to invoke the main method. So it saves memory.
*void* is the return type of method, it means it doesn't return any value.
*main* is a entry point of the program. Execution of programs starts from main. It is called by Runtime System
*String[] args* is used for command line argument. We will learn it later.
*System.out.println()* is used print statement.
No comments:
Post a Comment