Compiling a java program
C:>javac Demo.java
C:>javac Demo.java
- javac is a compiler that compiles our program (Demo.java) and create file(s) with extension .class.
- The class file contain byte code that are binary instruction for java interpreter.
Running a java Application
c:>java Demo
c:>java Demo
- The java program file must be saved with the extension .java.
- The java program is a collection of one or more classes.There is atleast one class in every program.
- We must save the program file with the same name as that of the class that is defined within it.(to avoid conflicts it is advised)
- We must put the code for each class in a separate file.(to avoid conflicts it is advised)