Here is a simple Java program which will print This is a simple Java program. on the screen.
When the above Java program is compile and executed, it will produce the following output:
When you run the above Java program, you will see the following output:
/* Java Program Example - Java Simple Program */ public class JavaProgram { public static void main(String args[]) { /* prints This is a simple Java program. */ System.out.println("This is a simple Java program"); } }
One More Simple Java Program Example
Following is also a simple Java program example :/* Java Program Example - Java Simple Program */ public class JavaProgram { public static void main(String args[]) { int num; // this declares a variable called num num = 10; // this assigns the value 10 to the num System.out.println("This is num: " +num); num = num * 2; System.out.println("The value of num * 2 is " +num); } }