JAVA TUTORIAL

Java Intro Java Features Java vs C++ Java Simple Program Java Applet vs Application JVM,JDK or JRE Java Keywords Java Variables Java Literals Java Separators Java Datatypes Java Operators Java Statements Java Array Java String

CONTROL STATEMENTS

Java If-else Java While Loop Java Do-While Loop Java For Loop Java For-each Loop Java Switch Java Break/Continue

JAVA METHODS

Java Method Java Overloading Java Overriding

JAVA CLASSES

Java OOPs Java Classes/Objects Java Inheritance Java Polymorphism Java Encapsulation Java Abstraction Java Modifiers Java Constructors Java Interface Java static keyword Java this keyword

Java Simple Program

In this page, we learn how to write a Simple java Program

First of all, are you know what are the requirement to write a simple java program. If you know then it's good but if you don't know then don't worry. Lets see the requirement

Requirement to write a simple java program

(i) First install the JDK if you don't have installed it, download the JDK and install it.

(ii) Set path of the jdk/bin directory.

(iii) Create a java program

(iv) Compile and run the java program

Example of Simple Java Program

class Simple{
public static void main(String args[]){
    System.out.println("Hii.. Java");
    }
}

NOTE: A file name must same as class name. For example in this program if you save this file as Main.java then it produce error message.

So save this file as Simple.java

To Compile

javac Simple.java

To Execute

java Simple

Output:

Hii.. Java