Java
is one of the most popular programming languages. Old name for java is OAK. It is one of the object oriented
programming language. Lot of open source application are developed using java.
Java
is platform independent language. Java program stored with .java extension(source
code). Java compiler compiles source code and converts into class file. Class file
load and execute using java interpreter. Java compiler is machine independent. Java
interpreter is machine dependent (JRE).
Write a simple hello world program in java
public class HelloWorld{
public
static void main(String arg[]){
System.out.println(“HelloWorld”);
}
}
Step
for compile and execute the java file
1. Save
the code as a HelloWorld.java
2. Compile.
cmd>Javac HelloWorld.java
3. Run.
cmd>Java HelloWorld
Note: After compile, you get HelloWorld.class file where
you stored in the HelloWorld.java location. This class is machine independent
you can copy and paste into some other machine and try to run.
No comments:
Post a Comment