General

Java Basic Programs

Java Basic Programs

Java Basic Programs

Everything in java is executed inside the class. There are three steps to run java program. They are

Step 1:

Type the program in notepad and save the filename should similar to a class name with .java extension.

Class FirstProgram
{
Public static void main(String[] args)
{
System.out.println(“This is my first java program”);
}
}
Save as FirstProgram.java.

Step 2:

Open command prompt -> goto the file saved path -> Then Compile the java program through Javac Filename.java.

Javac  FirstProgram.java

Step 3:

Run the java program through java Filename

Java  FirstProgram

Output:

This is my first java program

Click Here-> Get Java Training with Real-time Projects

Eagle Academy WhatsApp