/*
class ChangFangXing
{
int chang;
int kuan;
public void mian()
{
System.out.println("面积等于"+chang*kuan);
}
public void zhou()
{
System.out.println("周长等于"+(chang*2+kuan*2));
}
}
class ChangFangXingTest
{
public static void main(String[] args)
{
ChangFangXing cfx = new ChangFangXing();
cfx.chang = 20;
cfx.kuan = 30;
cfx.mian();
cfx.zhou();
}
}
*/
/*
class ChangFangXing
{
//int chang;
//int kuan;
public int mian(int length,int width)
{
//return (length*width);
return (length*width);
}
public int zhou(int length,int width)
{
//return(length*2+width*2);
return length*2+width*2;
}
}
class ChangFangXingTest
{
public static void main(String[] args)
{
ChangFangXing cfx = new ChangFangXing();
//cfx.chang = 20;
//cfx.kuan = 30;
System.out.println(cfx.mian(20,30));
System.out.println(cfx.zhou(20,30));
}
}
class ChangFangXingTest
{
public static void main(String[] args)
{
ChangFangXing cfx = new ChangFangXing();
cfx.chang = 20;
cfx.kuan = 30;
cfx.mian();
cfx.zhou();
}
}
*/
class ChangFangXing
{
int length = 60;
int width = 90;
//public int mian(int length,int width)
public int mian()
{
int length;
int width;
return (length*width);
}
//public int zhou()
//{
//return(length*2+width*2);
//}
}
class ChangFangXingTest
{
public static void main(String[] args)
{
ChangFangXing cfx = new ChangFangXing();
//cfx.length = 30;
//cfx.width = 60;
//System.out.println(cfx.mian());
//System.out.println(cfx.zhou());
int area = cfx.mian();
//int zhou = cfx.zhou();
System.out.println(area);
}
} |
|