标题:关于static的问题
取消只看楼主
czyboy123
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2006-2-16
 问题点数:0 回复次数:0 
关于static的问题
public class Static{
public static String str="kiki";
public void print(){
System.out.print(str);
}
public static void main(String[] args) {
//Static st1=new Static();
//Static st2=new Static();
Static.str="jason";
Static st2=new Static();
st2.print();
}
}
输出结果为什么是jason??
当Static st2=new Static();
st2.str应该为KIKI啊,那打印出来应该是KIKI啊?
为什么????
搜索更多相关主题的帖子: static 
2006-12-31 14:07



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-113395-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.483133 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved