//Simple java program print "HELLO WORLD!" on console.
CODE
public class Hello {
public static void main(String[] args){
System.out.println("HELLO WORLD!");
}
}
public class Hello {
public static void main(String[] args){
System.out.println("HELLO WORLD!");
}
}
EXECUTION
Copy the above code paste it in notepad and save with name "Hello.java" without quotes.
I am saving in my D:\java_programs\ folder
Now open the command prompt
Type the following code
C:\Users\Administrator>D:
D:\>cd java_programs
D:\java_programs>javac Hello.java
D:\java_programs>java Hello
if it show error like "Error: Could not find or load main class type
D:\java_programs>java -classpath . Hello.java
HELLO WORLD!
D:\java_programs>
Copy the above code paste it in notepad and save with name "Hello.java" without quotes.
I am saving in my D:\java_programs\ folder
Now open the command prompt
Type the following code
C:\Users\Administrator>D:
D:\>cd java_programs
D:\java_programs>javac Hello.java
D:\java_programs>java Hello
if it show error like "Error: Could not find or load main class type
D:\java_programs>java -classpath . Hello.java
HELLO WORLD!
D:\java_programs>
Comments
Post a Comment