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

    import java.util.Scanner;
      3 public class L {
      4 
      5     public static void main(String[] args) {
      6         System.out.println("5+5="+5+5);
      7         
      8         int a=3,b;
      9         b=a++;
     10         System.out.println("a="+a+",b="+b);
     11         
     12         short c=3;
     13         c=(short) (c+4);
     14         System.out.println("c="+c);
     15         
     16         short d=3;
     17         d+=4;
     18         System.out.println("d="+d);
     19         
     20         System.out.println(6&3);
     21         System.out.println(6|3);
     22         System.out.println(6^3);
     23         System.out.println(3<<2);
     24         System.out.println(3>>1);
     25         
     26         int e=0,f;
     27         f=e>1?100:200;
     28         System.out.println("f="+f);
     29         
     30         @SuppressWarnings("resource")
     31         Scanner input=new Scanner(System.in);
     32         int g,h;
     33         System.out.println("Enter the g ");
     34         g=input.nextInt();
     35         System.out.println("Enter the h ");
     36         h=input.nextInt();
     37         h=g>h?g:h;
     38         System.out.println("The larger of the two numbers is"+h);
     39         
     40         @SuppressWarnings("resource")
     41         Scanner input1=new Scanner(System.in);
     42         int x,y,z;
     43         System.out.println("Enter the x ");
     44         x=input1.nextInt();
     45         System.out.println("Enter the y ");
     46         y=input1.nextInt();
     47         System.out.println("Enter the z ");
     48         z=input1.nextInt();
     49         y=x>y?x:y;
     50         z=y>z?y:z;
     51         System.out.println("The largest of the three numbers is"+ z);
     52         
     53         @SuppressWarnings("resource")
     54         Scanner input11=new Scanner(System.in);
     55         int month;
     56         System.out.println("Enter the month ");
     57         month=input11.nextInt();
     58         if(month>=3&&month<=5){
     59             System.out.println("This month is spring");
     60                 }
     61         else if(month>=6&&month<=8){
     62             System.out.println("This month is summer");
     63                 }
     64         else if(month>=9&&month<=11){
     65             System.out.println("This month is autumn");
     66                 }
     67         else if(month==12){
     68             System.out.println("This month is winter");
     69                 }        
     70         else if(month>=1&&month<=2){
     71             System.out.println("This month is winter");
     72                 }
     73         else{
     74             System.out.println("Error!");
     75                 }
     76         
     77         @SuppressWarnings("resource")
     78         Scanner input111=new Scanner(System.in);
     79         int month1;
     80         System.out.println("Enter the month ");
     81         month1=input111.nextInt();
     82         switch (month1)
     83         {
     84         case 1: case 2: case 12:
     85             System.out.println("This month is winter");
     86             break;
     87         case 3: case 4: case 5:
     88             System.out.println("This month is spring");
     89             break;
     90         case 6: case 7: case 8:
     91             System.out.println("This month is summer");
     92             break;
     93         case 9: case 10: case 11:
     94             System.out.println("This month is autumn");
     95             break;
     96         default:
     97             System.out.println("Error!");
     98             break;
     99         }
    100     
    101         int i=1;
    102         do{
    103             System.out.println("i="+i);
    104             i++;
    105             }while(i<1);
    106         
    107         int j=1;
    108         while(j<1){
    109             System.out.println("j="+j);
    110             j++;
    111             }
    112         
    113         for(int k=1;k<3;k++)
    114         {
    115         System.out.println("k="+k);
    116         }
    117         
    118         int q=1;
    119         for(System.out.println("a");q<3;System.out.println("c"))
    120             {
    121             System.out.println("d");
    122             q++;
    123             }
    124     }
    125 }

  • 相关阅读:
    IDEA SpringBoot项目连接数据库报Acess denied错误解决方法
    字符流中出现的第一个字符
    数组中重复的数字
    替换空格
    数组中次数超过一半的数字
    表示数值的字符串
    正则表达式匹配
    SpringMVC中的视图和视图解析器
    IntelliJ Idea取消Could not autowire. No beans of 'xxxx' type found的错误提示
    spring中注解注入 context:component-scan 的使用说明
  • 原文地址:https://www.cnblogs.com/TingGeGe/p/7640499.html
Copyright © 2011-2022 走看看