第七次java作业
public class fff { int length; int width; public void getArea(){ System.out.println("s="+length*width); } public void getPer(){ System.out.println("c="+(length+width)*2); } public void showAll(){ System.out.println("s="+length); System.out.println("c="+width); getArea(); getPer(); } }
public class fff { public static void main(String[] args) { Rectangle R=new Rectangle(); R.length=3; R.width=2; R.showAll(); R.getArea(); R.getPer(); } }