if else 文
コード public class IF_ELSE { public static void main(String[] args) { System.out.println("Start"); // System.out.println("------------------------"); // int i = Integer.valueOf(args[0]).intValue(); if(i < 0) { System.out.println("Negative number"); }else if(i == 0){ System.out.println("Zero"); }else if(i == 1){ System.out.println("One"); }else{ System.out.println("Greater than Two"); } // System.out.println("------------------------"); System.out.println("End"); } }
結果 Start ------------------------ Greater than Two ------------------------ End