黑马程序员技术交流社区
标题:
我贴出来一段工具类代码,我是觉得大家不知道结果
[打印本页]
作者:
麦兜de篼
时间:
2015-1-18 14:17
标题:
我贴出来一段工具类代码,我是觉得大家不知道结果
class exctools
{
public static void exc(int a,int b)
{
int temp;
temp=a;
a=b;
b=temp;
}
}
class testexc
{
public static void main(String[] args)
{
int a=3,b=7;
System.out.println("a="+a+"b="+b);
exctools.exc(a,b);
System.out.println("a="+a+"b="+b);
}
}
复制代码
作者:
sq_jun
时间:
2015-1-18 14:27
a=3b=7
a=3b=7
只要把全局变量和局部变量搞懂,就应该不会出错
作者:
麦兜de篼
时间:
2015-1-18 14:31
sq_jun 发表于 2015-1-18 14:27
a=3b=7
a=3b=7
完了,我献丑了
作者:
sq_jun
时间:
2015-1-18 15:50
麦兜de篼 发表于 2015-1-18 14:31
完了,我献丑了
哈哈,我也菜鸟,以前学C的时候纠结过
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2