Public static Test public static void mainString args
Public static Test{ public static void main(String args[]){ 処理a 処理b } } 上から下に処理が行われている
public static Test{ public static void main(String args[]){ もし 1が選択されたら 処理a それ以外だったら 処理b } }
public static Testif{ public static void main(String args[]){ if(true){ //trueの時に実行される System. out. println(“next”); } } } ture、falseを書き換えてみて 1==1や5>=6でも
論理型 booleanにはtrueかfaleseがしか入らない boolean b = true; boolean bo = false; boolean boo = 3>5; //比較できる boolean bool = 5==5; boolean boole = 5<=3
public static Testif{ public static void main(String args[]){ if(条件){ System. out. println(“next”); }else{ System. out. println(“Game. Over”); } } }
public static Testif{ public static void main(String args[]){ if(条件){ System. out. println(“るーと1”); }else if(条件){ System. out. println(“るーと2”) ・ ・ } }
switch(){ case 値: 処理 break; ・ ・ default: 処理 }
- Slides: 11