ITPub博客

首页 > 应用开发 > > 为什么System.out.println(s1.schoolName);打印的结果是Tsinghua?

为什么System.out.println(s1.schoolName);打印的结果是Tsinghua?

作者:hedaodi 时间:2019-11-22 15:06:55 0 删除 编辑

class test

{

String name;

static String schoolName;

public static void main(String args[])

{

test s1=new test();

s1.name="张三";

s1.schoolName="gdgm";

test s2=new test();

s2.name="Tom";

s2.schoolName="Tsinghua";

System.out.println(s1.name); 

System.out.println(s1.schoolName);

}

}

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/1354/viewspace-3157485/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-04-15

  • 博文量
    107
  • 访问量
    1129