求教:帮忙分析下这道java面试题

[code="java"]class HasStatic{
private static int x=100;
public static void main(String args[ ]){
HasStatic hs1=new HasStatic( );
hs1.x++;
HasStatic hs2=new HasStatic( );
hs2.x++;
hs1=new HasStatic( );
hs1.x++;
HasStatic.x- -;
System.out.println(“x=”+x);
}
} [/code]
程序通过编译,输出结果为:x=102

[b]问题补充:[/b]
那么下面的一段程序的输出结果又是什么呢?要考虑changestr方法的static修饰吗?
多谢!
public class ChangeStrDemo {
public static void changestr(String str){
str="welcome";
}
public static void main(String[] args) {
String str="1234";
changestr(str);
System.out.println(str);
}
}

这段代码和static没有关系,这个是传引用,输出结果是1234\

建议阅读http://zangweiren.iteye.com/blog/214369

建议下载http://zangweiren.iteye.com/blog/241218

静态成员是所有实例共用的变量,一般编码的时候不推荐使用实例方式访问,最好以类方式访问
题目里面x最开始被设置初始值为100,自加了3次,自减了1次,结果为102