• 第四次作业10.9


    /*程序员:张立平

    需求1:输出 "5+5="+5+5
    */
     
    import java.util.Scanner;
    public class  Z
    {   public static void main(String[] args)
    {   System.out.println("5+5="+5+5);
      }
    }

    /*程序员:张立平

    需求2:输出 自增自减
    */
    import java.util.Scanner;
    public class  Z
    {   public static void main(String[] args)
    {
      int a=3,b;

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

     

    /*程序员:张立平

    需求3:输出
    */
    import java.util.Scanner;
    public class  Z
    {   public static void main(String[] args)
    {

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


    
    
    /*程序员:张立平

    需求4:运算符与或
    */
    import java.util.Scanner;
    public class  Z
    {   public static void main(String[] args)
    {
      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);
      }
    }

    
    
    /*程序员:张立平

    需求5:运算符
    */
    import java.util.Scanner;
    public class  Z
    {   public static void main(String[] args)
    {
      int e=0,f;
      f=e>1?100:200;
      System.out.println("f="+f);
      
      }
    }


    /*程序员:张立平

    需求6: 用三元运算符做联系
    */
    import java.util.Scanner;
    public class  Z
    {   public static void main(String[] args)
    {
      @SuppressWarnings("resource")
      Scanner input=new Scanner(System.in);
      int x,y;
      System.out.println("Enter the x ");
      x=input.nextInt();
      System.out.println("Enter the y ");
      y=input.nextInt();
      y=x>y?x:y;
      System.out.println("The larger of the two numbers is"+y);
      }
    }

    
    
    
    
    /*程序员:张立平

    需求7:用if循环判断季节
    */
    import java.util.Scanner;
    public class  Z
    {   public static void main(String[] args)
    {
      @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!");     }
      }
    }

    
    
    /*程序员:张立平

    需求8:使用switch判断季节
    */
    import java.util.Scanner;
    public class  Z
    {   public static void main(String[] args)
    {
     Scanner input=new Scanner(System.in);
            int month;
            System.out.println("Enter the month ");
            month=input.nextInt();
            switch (month)
            {
            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;
            }
        }
    }
     
     
     
     
     
  • 相关阅读:
    格式化HDFS 出现 java.io.IOException: Cannot create directory /opt/hdfs/name/current 错误
    Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
    解决:superset db upgrade时报错: ModuleNotFoundError: No module named 'dataclasses'
    Centos7 Conda HTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaco
    hive 窗口函数(三)
    hive 窗口函数(二)
    hive 窗口函数(一)
    hive 常用函数
    Centos7开机之后连不上网 ens33:<BROADCAST,ULTICAST>mtu 1588 qdisc noop state DOWl group default qlen 1888
    Hive 学习笔记(一)Hive 简介
  • 原文地址:https://www.cnblogs.com/zhangliping123/p/7704610.html
Copyright © 2020-2023  润新知