luohzzz

导航

运算符9

运算符

package operator;

public class Dome1 {
   public static void main(String[] args) {
       int a = 10;
       int b = 20;
       System.out.println(a+b);
       System.out.println(a-b);
       System.out.println(a*b);
       System.out.println(a/(double)b);

  }
}
package operator;

public class Dome2 {
   public static void main(String[] args) {
       long a = 234567890l;
       int b = 123;
       short c = 12;
       byte d = 2;
       System.out.println(a+b+c+d);//long
       System.out.println(b+c+d);//int
       System.out.println(c+d);//int
       System.out.println(d/(double)c);
  }
}
package operator;

public class Dome3 {
   public static void main(String[] args) {
       //关系符结果:true/false

       int a = 23;
       int b = 24;
       
       System.out.println(a>b);
       System.out.println(a<b);
       System.out.println(a==b);
  }
}

 

posted on 2021-04-20 23:28  luohzzz  阅读(39)  评论(0编辑  收藏  举报