求高手, 热心人帮助!
代码运行不通, 我GOOGLE了, 说是没main方法, 事实上我是写了main的,求大虾看看, 先谢了!不是吝啬分, 是想留着多问几个问题, 不想用申请N个马甲, 不过我相信你们不是为了分才来论坛的。 : )
package study.javase.test;abstract class Shape { public final double PI = 3.14; public Shape() { System.out.println("A shape was create."); } void draw() { System.out.println("Draw a shape"); } // abstract method abstract double area();}//class Circle extends Shape { int xpos; int ypos; int radius; public Circle() { super(); } public Circle(int x, int y, int r) { super(); xpos = x; ypos = y; radius = r; } public void draw() { System.out.println("draw a circle"); } public double area() { return PI*radius*radius; }}//class Rectangle extends Shape { int left; int top; int width; int height; public Rectangle() { super(); } public Rectangle(int l, int t, int w, int h) { super(); left = l; top = t; width = w; height = h; } public double area() { return width*height; }}public class Abstract { public static void main(String args[]) { Shape rec = new Rectangle(0, 0, 40, 30); System.out.println(rec.area()); rec.draw(); Shape sha = new Circle(120, 130, 50); System.out.println(sha.area()); sha.draw(); }}