#2 What is Syntax of Java Language | Why static in java ? Explanation of Every Code in Java

 





package com.sudhirtheindian2.java123;

class syntax_of_java {
public static void main(String[] arg) {
System.out.println("hi");


// 1- create a class and provide name
// example- syntax_of_java is class name



// 2- { open curley bracket


// 3-} close culey bracket


// 4 class has method, here main is method name
// main method - program execution start from here and end

// starting and ending point of the program is main method


// 5 why main method is public ?
// jvm(java virtual machine) run the program outside so
// main method is public
// if main method is not public then jvm can not run the program



// 6 why main method is static ?

// without making object of this class
// we can execute code written in main method

// 7 why main method is void ?
// there is no requirement to return anything


// 8 main(String[] args)
// if we pass anything in main method that is known parameter
// this is also known as command line arguments

// 9 here String is predefined class
// the name of class start with capital letter
// string is also use as a datatype in java


// 10
// args
// here args is array variable

}
}

टिप्पणियाँ

इस ब्लॉग से लोकप्रिय पोस्ट

Download Hindi Sanskrit Grammar App

HackerRank Java Currency Formatter (Hacker Rank Problem Solution)