• 国庆作业 (第四次作业)


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

    class York02 
    {
        public static void main(String[] args) 
        {
            int a=3,b;
            b=a++;
            System.out.println("a="+a+",b="+b);
        }
    }

    class York03 
    {
        public static void main(String[] args) 
        {
            short s=3;
            s=s+4;
            System.out.println("s="+s);
        }
    }

    class York04
    {
        public static void main(String[] args) 
        {
            short s=3;
            s+=4;
            System.out.println("s="+s);
        }
    }

     class York05
    {
        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);
        }
    }

    class York06
    {
        public static void main(String[] args)
        {
            int x=0,y;
            y=x>1?100:200;
            System.out.println("y="+y);
        }
    }

    class York07
    {
        public static void main(String[] args)
        {
            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);
        }
    }

    import java.util.Scanner;
    class York08
    {
        public static void main(String[] args)
        {
            Scanner input=new Scanner(System.in);
            int x,y,z;
            System.out.println("Enter the x ");
            x=input.nextInt();
            System.out.println("Enter the y ");
            y=input.nextInt();
            System.out.println("Enter the z ");
            z=input.nextInt();
            y=x>y?x:y;
            z=y>z?y:z;
            System.out.println("The largest of the three numbers is"+ z);
        }
    }

    import java.util.Scanner;
    class Demo_06
    {
        public static void main(String[] args)
        {
            Scanner input=new Scanner(System.in);
            int month;
            System.out.println("Enter the month ");
            month=input.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!");
    }
        }
    }

    import java.util.Scanner;
    class York10
    {
        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;
            }
        }
    }

     class York11
    {
        public static void main(String[] args)
        {
            int x=1;
            do{
                System.out.println("x="+x);
                x++;
                }while(x<1);
        }
    }

    class York12
    {
        public static void main(String[] args)
        {
            int y=1;
            while(y<1){
                System.out.println("y="+y);
                y++;
                }
        }
    }

  • 相关阅读:
    TP5.1 遇见问题整理
    PDO 基础
    php7 连接 mysql 的两种方式
    [php] 添加接口访问日志(文件)
    curl 向远程服务器传输file文件
    VBoxManage
    linux 系统下安装多个php版本
    vim中文乱码问题
    vim 翻页命令
    php list()函数
  • 原文地址:https://www.cnblogs.com/520peng/p/7640651.html
Copyright © 2020-2023  润新知