想问下12,13行的代码哪里有错,编译器一致显示错误但不知道错那
1 package com.四边形;
2 public class Quadrangle {
3 private int nextIndex=0;
4 private Quadrangle[] qtext=new Quadrangle[6];
5 public void draw(Quadrangle q) {
6 if (nextIndex<qtext.length) {
7 qtext[nextIndex]=q;
8 System.out.println(nextIndex);
9 nextIndex++;
}
}
10 public static void main(String[] args) {
// TODO Auto-generated method stub
11Quadrangle q=new Quadrangle();
//Parallelogramgle p=new Parallelogramgle();
//Square s=new Square();
12 q.draw(new Parallelogramgle());
13 q.draw(new Square());
}
14 public class Parallelogramgle extends Quadrangle{
15 public Parallelogramgle() {
16 System.out.println("平行四边形");
}
}
17 public class Square extends Quadrangle{
18 public Square() {
19 System.out.println("正方形");
}
}
}