Java Online Training In Andhra Pradesh and Telangana
Opening Hours :7AM to 9PM
public static void main(String args)
In the above syntax class: is a keyword. ClassName: ClassName any uder defined name. public static void main(): It is a main method or function.
Here public:public is a accessmodifier.
public means It runs anywhere(any Platform , any Processor) static: Here static is a one time memory allocation
void: is a no return type.
String args: It is a String array.It is used to store the keyboard values. System.out.println.: It is a output statement.
Here System: is a Class. out: This is an instance of PrintStream type, which is a public and static member field of the System class. println: is a method.
These output statements are classified into 2 types.
It is used to print the statements in a single line.
It is used to print the statements in a line by line.
Steps to write a java program
Open Notepad write the java program.
Save the Program with ClassName.java in any location
Path Setting: 1. Open MyComputer(This PC) open
and copy bin URL:
2: Right click on MyComputer(This PC)
Advanced System Settings
Take a New Option Varaible Name: path Variable Value: Paste copied bin Path
Click On Ok
Open Command Prompt and change the directory where the Java Program saved Syntax:
Compile the java program with the special syntax is Syntax:
Here javac is a compiler which is used to compile the java program and display the error in the program
If there is no error in the program it genarates.class file.
Run the java program Syntax: