How to Run JAVA Application

Steps to run the JAVA 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.

Syntax for JAVA

Syntax for a standalone application in Java:


import packages;

class <classname>
{
         public static void main(String args[])
         {
              statements;
              ————————;
              ————————;
         }
}

Variable Keywords in JAVA

Variable Keywords :

The following keywords are a special type of reference variable:

super : Reference variable referring to the immediate super class.
this : Reference variable referring to the current instance of an object.

Primitives in JAVA

Primitives :

The following keywords are primitives:

boolean : A value indicating true or false.
byte : An 8-bit integer (signed).
char : A single Unicode character (16-bit unsigned)
double : A 64-bit floating-point number (signed).
float : A 32-bit floating-point number (signed).
int : A 32-bit integer (signed).
long : A 64-bit integer (signed).
short : A 16-bit integer (signed).

Package in Java


Package Control :

The following are keywords used for package control:

import : Statement to import packages or classes into code.
package : Specifies to which package all classes in a source file belong.