java switch while用法

public static void main(String args[]) { 
int month = 4;
    String season;


    switch (month) {
      case 12: 
      case 1: 
      case 2:
        season = "Winter";
        break;
      case 3: 
      case 4: 
      case 5:
        season = "Spring";
        break;
      case 6: 
      case 7: 
      case 8:
        season = "Summer";
        break;
      case 9: 
      case 10: 
      case 11:
        season = "Autumn";
        break;
      default:
        season = "Bogus Month";
    }
    System.out.println("April is in the " + season + ".");

}

  public static void main(String args[]) {
    int i, j;


    i = 100;
    j = 200;


    // find midpoint between i and j
    while(++i < --j) ; // no body in this loop


    System.out.println("Midpoint is " + i);
  }

你可能感兴趣的:(java基础)