zoukankan      html  css  js  c++  java
  • 0929课堂随记

     1 package Yuju;
     2 
     3 public class yuju {
     4 
     5     public static void main(String[] args) {
     6         //
     7                 
     8         int age =18;
     9         
    10         //分支语句
    11         if(!(2<1||4>3))
    12         {
    13             System.out.println("我被执行了");
    14         }
    15         else
    16         {
    17             System.out.println("另外被执行了");
    18         }
    19         
    20         if(age<10)
    21         {
    22             System.out.println("小朋友,你好");
    23         }
    24         else if(age>10&&age<18)
    25         {
    26             System.out.println("同学,你好");
    27         }
    28         else
    29         {
    30             System.out.println("朋友,你好");
    31         }
    32         
    33         //三元运算符?:
    34         int a=0;
    35         
    36         if(age>15)
    37         {
    38             a=15;
    39         }
    40         else
    41         {
    42             a=0;
    43         }
    44         
    45         System.out.println("a="+a);
    46         
    47         int b=age>15?age:0;
    48         
    49         age=23;
    50         
    51         b=++age>23?(age++<25?--age:age++):--age;
    52         
    53         System.out.println("b="+b);
    54         System.out.println("age="+age);
    55         
    56         
    57         int c=50;
    58         
    59         switch(c)
    60         {
    61         case 20:
    62             
    63             System.out.println("c="+c);
    64             break;
    65             
    66         case 30:
    67             
    68             System.out.println("c="+c);
    69             break;
    70             
    71         case 40:
    72             
    73             System.out.println("c="+c);
    74             break;
    75             
    76             default://其他情况
    77                 System.out.println("其他c="+c);
    78         
    79         }
    80         
    81     }
    82 
    83 }
    Yuju
     1 package hello;
     2 
     3 public class hello {
     4 
     5     public static void main(String[] args) {
     6         
     7         int zizeng=10;
     8         zizeng++;
     9         //zizeng=zizeng+1;
    10         //zizeng++先赋值再自增;
    11         //++zizeng先自增载赋值;
    12         System.out.println("zizeng="+zizeng);
    13         
    14         int zijian=10;
    15         --zijian;
    16         //zijian=zijian-1;
    17         System.out.println("zijian="+zijian);
    18         
    19         System.out.println("1>o="+(1>0));
    20         
    21         //逻辑与
    22         System.out.println("true&&true&&false="+(true&&true&&false));
    23         System.out.println("true&&false="+(true&&false));
    24         
    25         //逻辑或
    26         System.out.println("true||false="+(true||false));
    27         System.out.println("true||true="+(true||true));
    28         
    29         //逻辑非
    30         System.out.println("!true="+!true);
    31         System.out.println("!false="+!false);
    32          
    33         int xi=345;
    34         
    35         //隐式转换             byte<short<int<long<float<double;
    36         long yl=xi;
    37         
    38         //显示转换
    39         int xin=(int)yl;
    40         
    41         //  单行注释
    42         /*     多行注释          */
    43         //关键算法处注释
    44         //说明一下判断规则
    45         //修改代码时注释一下
    46         
    47         
    48         
    49     }
    50 
    51 }
    hello
  • 相关阅读:
    【Android】Android消息处理机制
    【Android】Sensor框架HAL层解读
    【Android】Sensor框架Framework层解读
    【流媒体】初识流媒体与流媒体技术
    【Git】Git与GitHub 入门
    【Delphi】基于状态机的串口通信
    【Delphi】SPComm注意事项
    【Android】事件输入系统-代码层次解读
    【Android】事件处理系统
    【Android】窗口机制分析与UI管理系统
  • 原文地址:https://www.cnblogs.com/zxw0004/p/4847541.html
Copyright © 2011-2022 走看看