欢迎访问 生活随笔!

生活随笔

当前位置: 首页 >

java从小到大排序函数_利用随机函数产生10个1~100之间的整数,按从小到大的顺序排列输出...

发布时间:2023/12/10 44 豆豆
生活随笔 收集整理的这篇文章主要介绍了 java从小到大排序函数_利用随机函数产生10个1~100之间的整数,按从小到大的顺序排列输出... 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

public interface planeGraphics2

{

public abstract double area();

public abstract double perimeter();

public abstract void print();

}

public class rectangle2 implements planeGraphics2

{

protected double length;

protected double width;

public rectangle2(double length,double width)

{ this.length=length;

this.width=width;

}

public rectangle2(double width)

{

this.length=width;

this.width=width;

}

public rectangle2(0

{

this(0,0);

}

public rectangle2(rectangle2 r1)

{ this(r1.length,r1.width);

}

public double area()

{

return this.width*this.length;

}

public double perimeter()

{

return(this.width+this.length)*2;

}

public void print()

{

if (this.length==this.width)

system.out.println("一个矩形。边长为"+this.length);

else

system.out.print("一个长方形,长度为"+this.length+",宽度"+this.width);

system.out.println(",面积为"+this.area()+",周长为"+this.perimeter());

}

public static void main(string args[])

{

rectangle2 r1= new rectangle2(10,20);

r1.print();

r1=new rectangle2(10);

r1.print();

}

}

总结

以上是生活随笔为你收集整理的java从小到大排序函数_利用随机函数产生10个1~100之间的整数,按从小到大的顺序排列输出...的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。