作者fate9243 (大ing)
看板TTU-Transfer
標題[偷可] test
時間Fri Dec 26 11:17:23 2008
class CRectangle
{
private int length;
private int width;
private void show()
{
System.out.println("length= :"+length);
System.out.println("width= :"+width);
}
public CRectangle()
{
length=2;
width=2;
}
public CRectangle(int l,int w)
{
length=l;
width=w;
}
}
class CData extends CRectangle
{
public CData(int l,int w)
{
super(l,w);
}
CData()
{
super();
}
void area()
{
super.show();
System.out.println("area="+super.length*super.width);
}
}
public class fate
{
public static void(String args[])
{
CData obj1=new CData(3,8);
CData obj2=new CData();
obj1.area();
obj2.area();
}
}
好累= =
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.129.26.2
推 riverkids :程設是用什麼軟體跑呢? 12/26 14:38
→ derekwings :JCreator或JBuilder吧... 12/26 16:34
※ 編輯: fate9243 來自: 140.129.37.243 (12/27 16:00)