static
来源:互联网 发布:包贝尔鸡兔同笼算法 编辑:程序博客网 时间:2024/06/05 16:04
public class Test {
static class IntA{
private int a;
public IntA(int a){
this.a=a;
}
public int getA() {
return a;
}
public void setA(int a) {
this.a = a;
}
}
public static void change(int a){
a=3;
}
public static void change(IntA a){
a.setA(3);
}
public static void changeRef(IntA a){
a = new IntA(9);
}
public static void main(String args[]) {
int a = 2;
//堆栈
change(a);
//2
System.out.println(a);
IntA ia = new IntA(5);
change(ia);
//3
System.out.println(ia.getA());
changeRef(ia);
//3
System.out.println(ia.getA());
}
阅读全文
0 0
- static
- static
- static{}
- static
- static
- Static
- static
- static
- Static
- static
- static
- static
- static
- static
- static
- static
- static
- static
- 四种排序方法
- Redis Cluster 3.0搭建与使用
- 深入理解spring事务管理
- Java NIO学习资料
- 使用Flasl-Mail提供电子邮件支持
- static
- HttpClient
- solrCloud新建core或collection失败报Caused by: solr.DataImportHandler错误
- 每日MySQL之002:MySQL server连接与查询
- spring boot web filter的使用
- Git 搭建私有仓库
- 【JavaScript】JavaScript的第2个例子
- 在java中的正则表达式基础
- 运算符重载:赋值、类型转换