Syntax for a standalone application in Java:
********************************************************* class <classname>
{
public static void main(String args[])
{
statements;
————————;
————————;
}
}
*********************************************************
Steps to run the above application:
1. Type the program in the DOS editor or notepad. Save the
file with a .java extension.
2. The file name should be the same as the class, which has the
main method.
3. To compile the program, using javac compiler, type the
following on the command line:
Syntax: javac <filename.java>
Example: javac abc.java
4. After compilation, run the program using the Java
interpreter.
Syntax: java <filaname> (without the .java
extension)
Example: java abc
5. The program output will be displayed on the command line.
********************************************************* class <classname>
{
public static void main(String args[])
{
statements;
————————;
————————;
}
}
*********************************************************
Steps to run the above application:
1. Type the program in the DOS editor or notepad. Save the
file with a .java extension.
2. The file name should be the same as the class, which has the
main method.
3. To compile the program, using javac compiler, type the
following on the command line:
Syntax: javac <filename.java>
Example: javac abc.java
4. After compilation, run the program using the Java
interpreter.
Syntax: java <filaname> (without the .java
extension)
Example: java abc
5. The program output will be displayed on the command line.