示例代码:
- public class Hello{ //类名Hello class修饰,public公共的
- public static void main(String[] args){ //main()方法
- int i; //变量i,
- for(i=0;i<5;i++){ //for循环,打印变量i的值
- System.out.println("i=;"+i);
- }
- System.out.println("Hello World!!!"); //打印输出
- }
- int a=2,b=3;
- if(a<b){ //if语句
- System.out.println("a is less than b");
- }
- System.out.println();
- }