public class Test {

  public static void main(String[] args) {
int a = 10;
int b = 20;
int c = 25;
int d = 25;
System.out.println("a + b = " + (a + b) );
System.out.println("a - b = " + (a - b) );
System.out.println("a * b = " + (a * b) );
System.out.println("b / a = " + (b / a) );
System.out.println("b % a = " + (b % a) );
System.out.println("c % a = " + (c % a) );
System.out.println("a++ = " + (a++) );
System.out.println("a-- = " + (a--) );
// 查看 d++ 与 ++d 的不同
System.out.println("d++ = " + (d++) );
System.out.println("++d = " + (++d) );
}
}

public class selfAddMinus{
public static void main(String[] args){
int a = 3;//定义一个变量;
int b = ++a;//自增运算
int c = 3;
int d = --c;//自减运算
System.out.println("进行自增运算后的值等于"+b);
System.out.println("进行自减运算后的值等于"+d);
}
}
public class selfAddMinus{
public static void main(String[] args){
int a = 5;//定义一个变量;
int b = 5;
int x = 2*++a;
int y = 2*b++;
System.out.println("自增运算符前缀运算后a="+a+",x="+x);
System.out.println("自增运算符后缀运算后b="+b+",y="+y);
}
}

public class Test {

  public static void main(String[] args) {
int a = 10;
int b = 20;
System.out.println("a == b = " + (a == b) );
System.out.println("a != b = " + (a != b) );
System.out.println("a > b = " + (a > b) );
System.out.println("a < b = " + (a < b) );
System.out.println("b >= a = " + (b >= a) );
System.out.println("b <= a = " + (b <= a) );
}
}

public class Test {
public static void main(String[] args) {
int a = 60; /* 60 = 0011 1100 */
int b = 13; /* 13 = 0000 1101 */
int c = 0;
c = a & b; /* 12 = 0000 1100 */
System.out.println("a & b = " + c ); c = a | b; /* 61 = 0011 1101 */
System.out.println("a | b = " + c ); c = a ^ b; /* 49 = 0011 0001 */
System.out.println("a ^ b = " + c ); c = ~a; /*-61 = 1100 0011 */
System.out.println("~a = " + c ); c = a << 2; /* 240 = 1111 0000 */
System.out.println("a << 2 = " + c ); c = a >> 2; /* 15 = 1111 */
System.out.println("a >> 2 = " + c ); c = a >>> 2; /* 15 = 0000 1111 */
System.out.println("a >>> 2 = " + c );
}
}

public class Test {
public static void main(String[] args) {
boolean a = true;
boolean b = false;
System.out.println("a && b = " + (a&&b));
System.out.println("a || b = " + (a||b) );
System.out.println("!(a && b) = " + !(a && b));
}
}

public class LuoJi{
public static void main(String[] args){
int a = 5;//定义一个变量;
boolean b = (a<4)&&(a++<10);
System.out.println("使用短路逻辑运算符的结果为"+b);
System.out.println("a的结果为"+a);
}
}

public class Test {
public static void main(String[] args) {
int a = 10;
int b = 20;
int c = 0;
c = a + b;
System.out.println("c = a + b = " + c );
c += a ;
System.out.println("c += a = " + c );
c -= a ;
System.out.println("c -= a = " + c );
c *= a ;
System.out.println("c *= a = " + c );
a = 10;
c = 15;
c /= a ;
System.out.println("c /= a = " + c );
a = 10;
c = 15;
c %= a ;
System.out.println("c %= a = " + c );
c <<= 2 ;
System.out.println("c <<= 2 = " + c );
c >>= 2 ;
System.out.println("c >>= 2 = " + c );
c >>= 2 ;
System.out.println("c >>= 2 = " + c );
c &= a ;
System.out.println("c &= a = " + c );
c ^= a ;
System.out.println("c ^= a = " + c );
c |= a ;
System.out.println("c |= a = " + c );
}
}

public class Test {
public static void main(String[] args){
int a , b;
a = 10;
// 如果 a 等于 1 成立,则设置 b 为 20,否则为 30
b = (a == 1) ? 20 : 30;
System.out.println( "Value of b is : " + b ); // 如果 a 等于 10 成立,则设置 b 为 20,否则为 30
b = (a == 10) ? 20 : 30;
System.out.println( "Value of b is : " + b );
}
}

最新文章

  1. 高端大气上档次!10个精美的国外HTML5网站欣赏
  2. C# 消息队列
  3. kali 密码攻击
  4. TortoiseSVN使用简介(转)
  5. sublime mac快捷键
  6. jquery动态生成css样式表
  7. C++智能指针初学小结
  8. codeforces 665A Buses Between Cities
  9. [2016-07-15]结合命令行工具awk和多行文本编辑器快速生成DataSeed代码
  10. VM11 CentOS6.7 i386 安装 oracle 11g r2
  11. PAT1120: Friend Numbers
  12. Python json &amp; pickle, shelve 模块
  13. JVM学习一:JVM运行时数据区
  14. MyBatis 返回主键
  15. servlet中url-pattern之/与/*的区别
  16. jquery的bind()和trigger()
  17. TensorFlow函数(六)初始值生成函数
  18. MySQL学习笔记:少用Null
  19. Linux内核设计第三周学习总结 跟踪分析Linux内核的启动过程
  20. NSTimeZone时区

热门文章

  1. 【WPF学习】第二十四章 基于范围的控件
  2. 165-PHP 文本替换函数str_replace(六)
  3. 吴裕雄--天生自然JAVA SPRING框架开发学习笔记:Spring声明式事务管理(基于Annotation注解方式实现)
  4. UVA - 11277 Cyclic Polygons(二分)
  5. UVA - 10791 Minimum Sum LCM(最小公倍数的最小和)
  6. 【机器学习实战学习笔记(1-2)】k-近邻算法应用实例python代码
  7. HDU - 1068 Girls and Boys(二分匹配---最大独立集)
  8. struct寻址&amp;for反汇编
  9. 桥接 brctl
  10. BZOJ 4855 [Jsoi2016]轻重路径