HelloPlanet
P.Komisar
class HelloPlanet{
// Everything in java is defined inside a class. Here the class is called
HelloPlanet
public static void main(String[] args){
// The main method is the starting point of a Java program.
System.out.println("Hello World in Java " );
// This is how you get character
strings out to the console
}
// Each pair of curly braces define a scope or range of related code.
Here the main method ends
}
// Here the class ends
Steps
1) The source code needs to be saved
as a simple text file, with the same name as the class and appended
with the .java extension.(i.e HelloPlanet.java)
Note Java is case sensitive so helloplanet is considered a
different name
2) The source file's name with extension is provided as an argument
to the java compiler, javac. In other
words, type javac HelloPlanet.java
at the command line of the system you are using.
3) Once compiled without errors, a class
file is produced, (a file by the same name as the source
file
with a .class extension) This contains
the architecturally neutral bytecode.
4) The name of the class file (without the .class extension) is supplied
as an argument to java ,the java
interpreter, also known
as the JVM. The JVM translates
the architecturally neutral bytecode of the
class file into the executable format of the native
machine.