abstract class l_1//抽象类
{
protected String color;
public void setcolor(String str)
{
color = str;
}
abstract void show();
}
class l_2 extends l_1
{
int w , h;
public l_2 (int w1,int h1)
{
w=w1;
h=h1;
}
public void show()
{
System.out.print("color = "+color+",");
System.out.println("area = "+w*h);
}
}
class l_3 extends l_1
{
double r;
public l_3(double r1)
{
r=r1;
}
public void show ()
{
System.out.print("color = "+color+",");
System.out.println("area = "+r*r*3.14);
}
}
class l_4
{
public static void main (String [] args)
{
l_2 a = new l_2(4,5);
a.setcolor("yellow");
a.show();
l_3 b = new l_3(2.0);
b.setcolor("red");
b.show();
}
}