类名 对象名 new 类名
Car qq = new Car 由类创建对象的过程叫做 实例化,每个对象是类的一个实例!
qq.cpu=2.0f; 给cpu赋值1.0
qq.sendMessage(); 调用对象的方法
Car qq = new Car 由类创建对象的过程叫做 实例化,每个对象是类的一个实例!
qq.cpu=2.0f; 给cpu赋值1.0
qq.sendMessage(); 调用对象的方法
2018-03-02
没用scanner 凑活看吧
public class Calc {
public static void main(String[] args) {
// TODO Auto-generated method stub
Getcalc react = new React(30, 40);
react.getPerimeter();
react.getArea();
Getcalc circle = new Circle(20);
circle.getArea();
circle.getPerimeter();
}
public class Calc {
public static void main(String[] args) {
// TODO Auto-generated method stub
Getcalc react = new React(30, 40);
react.getPerimeter();
react.getArea();
Getcalc circle = new Circle(20);
circle.getArea();
circle.getPerimeter();
}
2018-03-01
package hellopolymorphic;
public class plane extends traffic {
public plane() {
a="飞机";
b="天空";
c=500;
super.transport(this.a,this.b,this.c);
}
}
public class plane extends traffic {
public plane() {
a="飞机";
b="天空";
c=500;
super.transport(this.a,this.b,this.c);
}
}
2018-02-27