class OblangTest
{
public static void main(String[] args)
{
Oblang c = new Oblang();
c.chang = 4;
c.kuan = 3;
System.out.println(c.area());
System.out.println(c.girth());
}
}
//长方形
class Oblang
{
int chang;
int kuan;
//面积
public int area()
{
return chang*kuan;
}
//周长
public int girth()
{
return (chang + kuan)*2;
}
}
|
|