The first Java program: HelloWorld

The first Java program HelloWorld,

Code001 : Program file name HelloWorld.java . 

public class HelloWorld{
	public static void main(String[] args){
		System.out.println("HelloWorld");
	}
}

 The program can be taught for the first half of the semester if willing and allowed to unfold.

 

 Constantly transform, experiment with the following program segments, and think about which ones can be compiled and run?

 

Code002 : Program file name HelloWorld2.java

class HelloWorld2{
	public static void main(String[] args){
		System.out.println("HelloWorld");
	}
}
 

 

Code003 : Program file name HelloWorld3.java

public class HelloWorld3{
	static public void main(String[] args){
		System.out.println("HelloWorld");
	}
}
 

 

Code004 : Program file name HelloWorld4.java

public class HelloWorld4{
	public static void mian(String[] args){
		System.out.println("HelloWorld");
	}
}
 

 

 

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326182941&siteId=291194637