2013年7月13日

java流程控制

摘要: package frank;public class App{ public static void main(String[] args) { String s = "一"; switch(s) { case "一": { System.out.println("今天星期一"); break; } default: { System.out.println("火星人!"); } } Boolean b = true; while(b) { System.out.println("while语句!&quo 阅读全文

posted @ 2013-07-13 11:42 wp456 阅读(163) 评论(0) 推荐(0)

java中把两个变量进行值交换,通过异或两次运算就能实现值互换。

摘要: package frank;public class App{ public static void main(String[] args) { int a = 2;//00000000000000000000000000000010 int b = 3;//00000000000000000000000000000011 a = a ^ b;//00000000000000000000000000000001 b = a ^ b;//00000000000000000000000000000010 a = a ^ b;//000000000000000000000000000000... 阅读全文

posted @ 2013-07-13 09:35 wp456 阅读(1440) 评论(0) 推荐(0)

导航