Lets write the Hello world Programming in Java
Java Example1
1 2 3 4 5 6 7 | public class Example1 { public static void main(String[] args) { System.out.println("Hello World"); } } |
Output
Hello World
How to run the Programming
First Step have to Compile the Program use Javac command
Javac Example1.java
Javac Command and Class name
After complie the program run the program
Lets write the Example2
1 2 3 4 5 6 7 | public class Example2 { public static void main(String[] args) { System.out.println("-----Java---------"); } } |
Output
—–Java———
Lets write the Example3
1 2 3 4 5 6 7 | public class Example3 { public static void main(String[] args) { System.out.println("******Java******"); } } |
******Java******
Lets write the Example4
1 2 3 4 5 6 7 8 9 10 11 | public class Example14 { public static void main(String[] args) { System.out.println("*"); System.out.println("**"); System.out.println("***"); System.out.println("*****"); System.out.println("******"); } } |
*
**
***
*****
******
Lets write the Example5
1 2 3 4 5 6 7 8 9 10 11 | public class Example1 { public static void main(String[] args) { System.out.println("John"); System.out.println("Peter"); System.out.println("Steve"); System.out.println("James"); System.out.println("jim"); } } |
John
Peter
Steve
James
jim
Lets write the Example6
1 2 3 4 5 6 7 8 9 10 11 | public class Example6 { public static void main(String[] args) { System.out.println("---------------------"); System.out.println(" Peter "); System.out.println(" Steve "); System.out.println(" James "); System.out.println(" Jim "); } } |
Output
———————
Peter
Steve
James
Jim