标题: 关键字static的标准格式 [打印本页] 作者: Yunny 时间: 2015-7-15 00:50 标题: 关键字static的标准格式 class Building {
static int hight;
static String name;
static String color = "silver";
public Building (String name,int hight) {
this.hight = hight;
this.name = name;
}
public static void show(){
System.out.println("名字:"+name+"高度:"+hight);
}
}
class StaticTest {
public static void main(String[] args) {
Building l = new Building("fever",130);
l.show();
System.out.println(Building.color);
Building.show();
}
}