正在加载图片...
43.interface Shape double area(); double girth(); class Rectangle implements Shape int a,b; public Rectangle(int aa,int bb)(a=aa;b=bb;} public double area()(return a b;} public double girth(){return 2 *(a++b);} } public class XXK3 public static void main(String[]args)( Shape x; x=new Rectangle(5,8); System.out.println(x.area()+","+x.girth()); 44.public class XXK4{ public static void main(String[]args){ int []a=new int[6]; int i,s=0; for(i=1;i<a.length;i++)a[i]=a[i-1]+2; for(i=0;i<a.length;i++)s+=ai]; System.out.println("s="+s); } 157843. interface Shape { double areaC) ; double girthC) ; class Rectangle implements Shape { int a , b; public Rectangle(int aa , int bb) {a==aa; b== bb public double area() {return 头b; } public double girth() {return 2 * (a+b) public class XXK3 { public static void mainC String[J args) Shape x; x==new RectangleC5 ,8 ) ; System. out. printlnC x. areaC) "+ x. girthC) ) ; 44. public class XXK4 { public static void mainCString[J args) int [Ja==new int[6J; int i ,s==0 ; forCi==l; i<a.length; i+ a[iJ == a[i -lJ 十2; forCi==O; i<a.length; i++) == a[i]; System. out. println(" s== "十 ; 1578
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有