This is very first Hello World Program written in java , it will introduce you basic structure and syntax of java program.
- Install JVR ( Java Vartual Machine )
JVR is environment, required for running Java Programs on your Computer. - Install J2SDK ( Java Software Development Kit )
JSDK is development kit which include JAVA Compiler for compiling your java program. - Note Pad
Note pad or Word pad is required for Writing Java Programs. - DOS
Java programs are Compiled through DOS.
Your First Hellow World Program
class HelloWorld { public static void main(String[] arguments) { System.out.println("Hello World !!!"); } }
- Copy above program in Notepad
- Now save program as helloworld.java in Bin Folder where java J2SDK is installed
- Open Dos Command Prompt
- Set the path of Bin folder
example:-
C:\j2sdk\bin\ - compile Java Program
example:-
C:\j2sdk\bin\javac helloworld.java - If no error Java will create class file
- Run java Program
example:-
C:\j2sdk\bin\java helloworld - Output will be
example:-
Hello World !!!
Class
The class statement is the way you give your computer program a name. It’s also used to determine other things about the program, as you will see later. The significance of the term class is that Java programs also are called classes.
What the main Statement Does
The next line of the program is the following:
public static void main(String[] arguments) { }
This line tells the computer, “The main part of the program begins here.” Java programs are organized into different sections, so there needs to be a way to identify the part of a program that will be handled first.
The main statement is the entry point to most Java programs. The exceptions are applets, programs that are run in conjunction with a World Wide Web page, and servlets, programs run by a web server. Most programs you will write during upcoming hours use main as the starting point.
discuss this topic to forum
