10.1

package Z;
import java.util.Scanner;
public class L {

  public static void main(String[] args) {
      System.out.println("5+5="+5+5); 

  int a=3,b;
      b=a++;
      System.out.println("a="+a+",b="+b); 

      short c=3;
      c=(short) (c+4);
      System.out.println("c="+c);

     
      short d=3;
      d+=4;
      System.out.println("d="+d);

     
      System.out.println(6&3);
      System.out.println(6|3);
      System.out.println(6^3);
      System.out.println(3<<2);
      System.out.println(3>>1);

 
      int e=0,f;
      f=e>1?100:200;
      System.out.println("f="+f);

      @SuppressWarnings("resource")
      Scanner input=new Scanner(System.in);
      int g,h;
      System.out.println("Enter the g ");
      g=input.nextInt();
      System.out.println("Enter the h ");
      h=input.nextInt();
      h=g>h?g:h;
      System.out.println("The larger of the two numbers is"+h);

      @SuppressWarnings("resource")
      Scanner input1=new Scanner(System.in);
      int x,y,z;
      System.out.println("Enter the x ");
      x=input1.nextInt();
      System.out.println("Enter the y ");
      y=input1.nextInt();
      System.out.println("Enter the z ");
      z=input1.nextInt();
      y=x>y?x:y;
      z=y>z?y:z;
      System.out.println("The largest of the three numbers is"+ z);

  

  @SuppressWarnings("resource")
      Scanner input11=new Scanner(System.in);
      int month;
      System.out.println("Enter the month ");
      month=input11.nextInt();
      if(month>=3&&month<=5){
          System.out.println("This month is spring");
              }
      else if(month>=6&&month<=8){
          System.out.println("This month is summer");
              }
      else if(month>=9&&month<=11){
          System.out.println("This month is autumn");
              }
      else if(month==12){
          System.out.println("This month is winter");
              }       
      else if(month>=1&&month<=2){
          System.out.println("This month is winter");
              }
      else{
          System.out.println("Error!");
              }

      @SuppressWarnings("resource")
      Scanner input111=new Scanner(System.in);
      int month1;
      System.out.println("Enter the month ");
      month1=input111.nextInt();
      switch (month1)
      {
      case 1: case 2: case 12:
          System.out.println("This month is winter");
          break;
      case 3: case 4: case 5:
          System.out.println("This month is spring");
          break;
      case 6: case 7: case 8:
          System.out.println("This month is summer");
          break;
      case 9: case 10: case 11:
          System.out.println("This month is autumn");
          break;
      default:
          System.out.println("Error!");
          break;
      }

      int i=1;
      do{
          System.out.println("i="+i);
          i++;
          }while(i<1);
     
      int j=1;
      while(j<1){
          System.out.println("j="+j);
          j++;
          }
     
      for(int k=1;k<3;k++)
      {
      System.out.println("k="+k);
      }
     
      int q=1;
      for(System.out.println("a");q<3;System.out.println("c"))
          {
          System.out.println("d");
          q++;
          }
  }
}


 

原文地址:https://www.cnblogs.com/fm10086/p/7791092.html