Let’s write a java hello, world! program and execute it from command line.
Program
class Hello { public static void main(String args[]){ System.out.println("Hello, World!"); } }
Now, Let’s try to compile it using javac
and execute it using java
command as shown below,
javac Hello.java
java Hello
Output
Hello, World!