类是一种模版,不能直接使用,需要照模版生成具体的实体才能够用,比如
定义:
public class Human{
private String name;
private int age;
private String sex;
public String getName(){
return name;
}
}
使用:
Human people = new Human();
people.getName();
变量简单来说就是一中引用指针.
类就想当于 设计模型,不能直接使用, 对象就是按照模型做出来的产品,实实在在用得到的
这些基础的东西你多看些书和例题,有些东西没接触过理解不了
温馨提示:答案为网友推荐,仅供参考