Steps to write Java program
--------------------------------------
1) Download JDK-19 or higher version from
https://www.oracle.com/java/technologies/downloads/
2) To write the program we can use any of the following editor or IDE
(Integrated Development Environment)
-> Notepad
-> Sublime Text
-> VS Code
-> NetBeans
-> Eclipse, etc.
3) Write your program and save it at the following path:
C:\Program Files\Java\jdk-19\bin
4) Every Java program must be save in a file with extension ".java"
Exmaple: Sample.java
5) Open the folder "C:\Program Files\Java\jdk-19\bin", in the address-bar type cmd and press Enter key
(It will open a Command Prompt)
6) Enter following commands on the command prompt to compile and run the program
i) Compile As:
javac file_name.java <Enter>
ii) Run As:
java class_name_having_main <Enter>
Sample.java
--------------------
class Sample
{
public static void main(String[] args)
{
System.out.println("WELCOME TO JAVA");
System.out.println("AMRAVATI");
}
}
Compile As:
Sample.java
Run As:
java Sample
Output:
WELCOME TO JAVA
AMRAVATI
Comments
Post a Comment