234234234

对象的创建和使用

对象是类的实例。比如张三是人这个类的一个实例。


 

package demo5;

public class People{
  String name;

  String static final type =  "人";

  int age;
  public void work() {

    String worktime;

    String workcity;

  } 
}


 

package demo5;

public class Student {
public static void main(String[] args) {
  People zhangsan = new People(); // 存放在堆内存
  }
}

posted @ 2018-06-10 21:05  你若愿意,我一定去  阅读(122)  评论(0编辑  收藏  举报
23423423423