HUO Computer Tips and tricks

Welcome to My Website. This website about Computer, Mobile and internet Tips and tricks,free Softwares and many more...

Welcome to My website

اسلام علیکم میرےویب سائٹ میں آنے کا بہت بہت شکریہ آپ اس ویب سائٹ میں مختلف کمپیوٹر،موبائل اور انٹرنٹ ٹپس اور ٹرکس سیکھ سکتے ہیں۔۔ ﷽ اVisit my new Website www.courseshub.org for free couses and other educational stuff

Monday, 12 March 2018

```First 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