How Java Program Work? / Java Program Life Cycle
OOPS concepts in Java
Java tutorials for beginners
Java basics concepts
Java Objects and Classes
What is Inheritance in Java?
What is Abstraction in Java?
What is Interface in Java?
What is Abstract Class in Java?
What is Polymorphism in Java?
What is Encapsulation in Java?
Java programming example
How Java Program Work?
Hello World in Java
Java basics for beginners
Step 1: Write Java Program.
Step 2: Compile java file to class file and generate byte code.
Step 3: Byte code translate to machine code and run on JVM.
Steps to write, compile and run java program using command prompt.
(i). Save the program. After using a text editor, such as NotePad, to create your Java program, save the program with a .java extension.
(ii). Open Command Prompt.
(iii). Navigate to the correct folder.
(iv). Set path.
(iv). Set path.
(v). Compile the program.
(vi). Run the program.
Create class as Demo and save as Demo.java in correct folder.Class name and file name should be same.
public class Demo {
public static void main(String args[]){
System.out.println("First java program is successes");
}
}
Set path in Java
Click on Advanced system settings.
Click on Environment Variables.
Set JAVA_HOME (to java home path)
Example: C:\Program Files\Java\jdk1.8.0_111
Set PATH(Path to Java bin directory)
Example: C:\Program Files\Java\jdk1.8.0_111\bin
Compile the program with command javac Demo.java
Run the program in command prompt
Example: java Demo(Class
name)
Output will be showing on command prompt on press enter button after
writing the run command.
Very good tutorial. I have prepared this tutorial, its helped me to increase my java knowledge in details.
ReplyDeleteExcellent Post. Are you looking for Laptops for your training? Click here Laptop Price to select your idle Laptop in budget.
ReplyDeleteExcellent Post. Are you looking for Laptops for your training? Click here Laptop Price to select your idle Laptop in budget.
ReplyDelete