问答详情
源自:12-1 综合练习

没有任何报错,却无法显示pica类的信息

http://img.mukewang.com/5969e9bd000142cf04120151.jpg

private static vehicle[] cars = {new car(1,"奥迪A4",500,4),
                               new car(2,"马自达6",400,4),
                               new pica(4, "皮卡6", 300, 4, 1),
                               new car(4,"金龙",800,20),
                               new truck(5,"松花江",400,4),
                               new truck(6,"依维柯",1000,20)};
 
 public static void main(String[] args) {
  
  // TODO Auto-generated method stub
  System.out.println("欢迎使用答答租车系统!");
  System.out.println("您是否要租车?(1是 0否)请选择:");
  Scanner input = new Scanner(System.in);
  int choice = input.nextInt();
  //调用键盘输入
  if (choice != 1) {
   System.out.println("欢迎再次光临");
  System.exit(0);
  }
  else{ //打印车辆信息
   System.out.println("您可租车的类型及其价目表如下所示:");
   System.out.println("序号  汽车类型               租金           容量");
   for (vehicle car : cars){
    System.out.println(car);
    }
   }

提问者:预示回眸 2017-07-15 18:11

个回答

  • 不语忘语
    2017-07-15 19:53:54
    已采纳

    是不是构造方法有问题啊