HOW To start Java Program


To start with Java Program

Prerequisites for java Program

For executing any java program we require given things.

Ventures For aggregating and executing the java program

Java is exceptionally basic programming dialect first we compose a java program and spare it with system class name.

In underneath project we make a java program with “First” name so we spare this system with “First.java” document name. We can spare our java program anyplace in our framework or PC.

Create First program

Example

class First
{
public static void main(String[] args) 
{
System.out.println("Hello Java");                 
System.out.println("My First Java Program");                      
}
}

Compile and Execute Java Code

To compile: javac First.java
To execute: java First

Output

Hello Java
My First Java Program

Save Java Program

Syntax:
Filename.java
Example:
First.java

Compile Java Program

Syntax:
Javac Filename.java
Example:
Javac First.java

Note: Here Javac and Java are called devices or application programs or exe records created by sun miniaturized scale framework and supply as a piece of jdk 1.5/1.6/1.7 in receptacle organizer. Javac is utilized for accumulate the java system and java is utilized for run the java program.

Amid the system execution inside after strides will be happens.

Class loader subsystem loads or exchange the predefined class into fundamental memory(RAM) from optional memory(hard plate)

JVM takes the stacked class

JVM searches for fundamental technique in light of the fact that every last java program begin executing from principle() strategy.

Since fundamental() technique for java is static in nature, JVM call the principle() strategy as for stacked class (Example: First as First.main(- - ))

Note: A java project can contain any number of primary strategy yet JVM begin execution from that fundamental() technique which is taking cluster of object of String class.


Leave a Reply