zoukankan      html  css  js  c++  java
  • 作业练习

    //程序员:乔建伟 2017.10.8
    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++;
                                      }
                     }
     }

     

     

     

  • 相关阅读:
    在Mybatis中使用连表查询的一次实际应用
    Mybatis使用generatedKey在插入数据时返回自增id始终为1,自增id实际返回到原对象当中的问题排查
    一次org.springframework.jdbc.BadSqlGrammarException ### Error querying database Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException问题排查过程
    商品的spu、sku及其之间的关系
    Java transient关键字的理解
    关于Serializable的一个形象的例子
    一个很大的文件,存放了10G个整数的乱序数列,如何用程序找出中位数。
    Logger.error方法之打印错误异常的详细堆栈信息
    什么是Http无状态?Session、Cookie、Token三者之间的区别
    接口API中的敏感数据基于AES进行安全加密后返回
  • 原文地址:https://www.cnblogs.com/jingjing1314/p/7639843.html
Copyright © 2011-2022 走看看