zoukankan      html  css  js  c++  java
  • 国庆作业

    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++;
                }
        }
    }

  • 相关阅读:
    为Qtcreator 编译的程序添加管理员权限
    热备,冷备,云备
    最近面试java后端开发的感受:如果就以平时项目经验来面试,通过估计很难——再论面试前的准备
    进入2012 -- 回顾我走过的编程之路
    为什么中国程序员水平一直上不了层次?无非是这些原因!
    我是如何失去团队掌控的?
    后端开发甩锅奥义
    一个线程oom,进程里其他线程还能运行吗?
    架构师必备,带你弄清混乱的JAVA日志体系!
    IDEA一定要改的八条配置
  • 原文地址:https://www.cnblogs.com/hhr1998/p/7640555.html
Copyright © 2011-2022 走看看