Lets create a simple program.
OUTPUT: Hello World
Explanation:
When we compile the program, the compiler compiles and creates a .class file.
When we run the program, Java Virtual Machine(JVM) loads the .class file.
Here, Java converts all the contents of source file to byte code thats the reason we get a .class file after the compilation of the program.
PREVIOUS NEXT
JAVA PROGRAM:
class myfirstprogram{
public static void main(String args[]){
System.out.println("Hello World");
}
}
OUTPUT: Hello World
Explanation:
class keyword Javaprogram name of the class{ opening of the class
public access key static used for calling without an object void doesn't return a value main name of the method (String args[]) argument to the method{ opening of main
System class in java.lang package.out field.println object("Hello World");
} closing of main
}closing of class
When we compile the program, the compiler compiles and creates a .class file.
When we run the program, Java Virtual Machine(JVM) loads the .class file.
Here, Java converts all the contents of source file to byte code thats the reason we get a .class file after the compilation of the program.
PREVIOUS NEXT
Comments
Post a Comment