案例一:

public class test1 {

public static void mb_swap(String Str1,String Str2) {

    String temp=Str1;
Str1=Str2;
Str2=temp; } public static void main(String[] arg) { String str1="A";
String str2="B"; mb_swap(str1,str2); System.out.print(str1+" "+str2); }

}

输出str1与str2结果为“A”、“B”

案例二:

public static void mb_swap(String[] s) {

    if (s.length < 2)

        return;

    String t = s[0];

    s[0] = s[1];

    s[1] = t;

}

public static void main(String[] arg) {

    String[] s = { "1", "2" };

    mb_swap(s);

    System.out.print(s[0] + s[1]);

}
输出结果:21

最新文章

  1. Bootstrap-datetimepicker年月日
  2. pygal and matplotlib(again)
  3. js实现cookie记住密码
  4. ArangoDB介绍——未知架构和底层原理
  5. linux shell 当前时间
  6. lower_bound实现函数
  7. Android 中的 Service 全面总结 (转)
  8. TabControl控件中TabPage的显示和隐藏
  9. POJ 3208 Apocalypse Someday
  10. Intent.ACTION_TIME_TICK 广播
  11. 《how to design programs》12章函数复合
  12. linux之SQL语句简明教程---SELECT
  13. HDU 1950 Bridging signals (DP)
  14. CentOS安装glibc-2.14,错误安装libc.so.6丢失急救办法
  15. MySQL索引(1)
  16. Android开发——BroadcastReceiver广播的使用
  17. UNIX网络编程——带外数据小结
  18. C#将一个枚举里面所有描述和value绑定到下拉列表的方法
  19. CF822C Hacker, pack your bags!(思维)
  20. MySQL— 进阶

热门文章

  1. 【bzoj1260】[CQOI2007]涂色paint
  2. linux下库的使用
  3. overwrite 复制
  4. YTU 2542: 弟弟的作业
  5. 利用游标返回结果集的的例子(Oracle 存储过程)JAVA调用方法和.NET调用方法
  6. UVA 10559 Blocks —— 区间DP
  7. Eclipse 安装 Maven 插件的几种方法
  8. E20180127-hm
  9. 07-11 Linux命令操作
  10. bzoj2679: [Usaco2012 Open]Balanced Cow Subsets(折半搜索)