标签:用户 this rgs rectangle alt 标识 信息 turn col
    public class new1{
        private double width, height;
        private String color;
    
        public new1(double width, double height, String color) {
            this.setWidth(width);
            this.setHeight(height);           
            this.setColor(color);
        }
        public new1() {
            // TODO Auto-generated constructor stub  
        }
        public void setWidth(double width) {
            this.width = width;
        }
        public void setHeight(double height) {
            this.height = height;
        }
        public void setColor(String color) {                  
            this.color = color;
        }
        public double getWidth() {
            return width;
        }
        public double getHeight() {
            return height;
        }
        public String getColor() {                           
            return color;
        }
        public double getArea() {
            return this.width*this.height;              
        }
        public double getGetlength() {
            return (this.height+this.width)*2;       
        }
        public static void main(String[] args) {
            new1 a=null;
            a = new new1();        
            a.width=7.0;                                          
            a.height=8.0;
            System.out.println(+a.getArea());              
            System.out.println(+a.getGetlength());
        }
    }太难了

public String concat(String str)
该方法的参数为一个String类对象,作用是将参数中的字符串str连接到原来字符串的后面.
有了解在important static静态输入之后比原来的代码输入要更为简洁,不必在System.out.println中键入System。
包是java里的文件夹,包是在使用多个类或接口时,为了避免名称重复而采用的一种措施。程序中的关键字为package。
数组一定要先开辟空间;并且数组里面的每一个对象都是null值,所以在使用的时候数组中的每一个对象必须分别进行实例化。
标签:用户 this rgs rectangle alt 标识 信息 turn col
原文地址:https://www.cnblogs.com/9557yxl/p/11560034.html