使用列表的sort方法可以进行排序,其中有两个参数用来表示排序的方式,代码: In [7]: a = ['x11','abc323','e26','112ddd'] In [8]: a.sort(key=len, reverse=True) In [9]: a Out[9]: ['abc323', '112ddd', 'x11', 'e26'] In [10]: a.sort(key=lambda x:x[-1]) In [11]: a Out[11]: ['x11', 'abc323', 'e
package zhongqiuzuoye; public class Rect { public double width; public double height; Rect(double width,double height) //带有两个参数的构造方法,用于将width和height属性初化; { this.width=width; this.height=height; } Rect() //不带参数的构造方法,将矩形初始化为宽和高都为10. { width=10; height=