???Java??staitc?????
???????????? ???????[ 2014/11/13 13:44:41 ] ????????Java ???? ????? ??????η?
???????static????
????static???????η?????????о?????η?????????????????????κα???????????????????????????????????洢???????ν????????????????????????????????????????????????????????????????????У???????????????????????????????????
??????Java???????棬????????????????????????????????????????????????????????????????±??????????????????????????ò??????????Щ??????????????????????ó??????static???????
????static???????????????????????????????
1 class Demo{
2 public static void main(String[] args)
3 {
4 Person p = new Person();
5 System.out.println(p.country); //1????????????
6 System.out.println(Person.country); //2???????????????
7 }
8 }
9 class Person{
10 static String country = "china";
11 }
????????static???
???????????ó?static?????
????a??static????????η??????????γ????
????b??static???ε????????е???????
????c??static?????????????static?????????????????????
????d??static???γ?????????÷??--??????????á?
???????????????????????????
????1.???????????????????
????????????????????????????????????
?????????????????????????????????????????
????2?????÷??
?????????????????????á?
????????????????????????????????????á?
????3??????д洢λ?ò????
????????????洢???????С?
????????????洢?????????????????????????????
????????????????????
????1??????????????????????
????2??????????в???????this??super???????
????3?????????????????
class Demo{
public static void main(String[] args)
{
Person.show();
}
}
class Person{
static String country = "china";
String name = "jinfulin";
public static void show()
{
System.out.print(country); //???
//System.out.print(name); //????
}
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11