类是一个抽象的概念,是由相同属性、方法的对象的集合,相当于一个模具的模子,可以产生许多的对象实体。
如手机类(模子)可以产生 HauWei、OPPO、ML等等的具体品牌的手机
如手机类(模子)可以产生 HauWei、OPPO、ML等等的具体品牌的手机
2015-07-09
UML:统一建模语言(标准建模语言)
常用UML图:
用例图、序列图、类图
UML建模工具:
VIsio、rational rose、powerDesign
常用UML图:
用例图、序列图、类图
UML建模工具:
VIsio、rational rose、powerDesign
public class Ship extends Traffic {
int people=200;
String place="夏威夷";
public void run(String traffic){
System.out.println(people+"人"+"通过"+traffic+"到达"+place);
}
}
int people=200;
String place="夏威夷";
public void run(String traffic){
System.out.println(people+"人"+"通过"+traffic+"到达"+place);
}
}
2015-07-08
public class Plane extends Traffic {
int people=500;
String place="休斯敦";
public void run(String traffic){
System.out.println(people+"人"+"通过"+traffic+"到达"+place);
}
}
int people=500;
String place="休斯敦";
public void run(String traffic){
System.out.println(people+"人"+"通过"+traffic+"到达"+place);
}
}
2015-07-08
public class Traffic {
int people;
String place;
public void run(String traffic){
System.out.println(people+"人"+"通过"+traffic+"到达"+place);
}
}
int people;
String place;
public void run(String traffic){
System.out.println(people+"人"+"通过"+traffic+"到达"+place);
}
}
2015-07-08
public class initial {
public static void main(String args[]){
Traffic obj1=new Traffic();
Traffic obj2=new Ship();
Traffic obj3=new Plane();
obj2.run("Ship");
obj3.run("Plane");
}
}
public static void main(String args[]){
Traffic obj1=new Traffic();
Traffic obj2=new Ship();
Traffic obj3=new Plane();
obj2.run("Ship");
obj3.run("Plane");
}
}
2015-07-08
终于搞定了。。。第一个Java项目-_-| ,源代码请移步我的github:https://github.com/ComputeAero/DadaRentalCar