字节集-编码操作-中繁体-StringBuffer-包装类

package workhome;

public class BuilderDemo {
public static void main(String[] args) {
    //builder模式
    //方法链编程    
    Person1 p = new Person1()
                .setName("tom")
                .setAge(12)
                .setSex("女");
}
}
BuilderDemo
package workhome;

public class Person1 {

    private String name;
    private int age;
    private String sex;
    
    
    public Person1 getName() {
        return this;
    }
    public Person1 setName(String name) {
        this.name = name;
        return this;
    }
    public Person1 getAge() {
        return this;
    }
    public Person1 setAge(int age) {
        this.age = age;
        return this;
    }
    public Person1 getSex() {
        return this;
    }
    public Person1 setSex(String sex) {
        this.sex = sex;
        return this;
    }
    
    
}
Person1
package workhome;

public class StringBuilderDemo {
public static void main(String[] args) {
    StringBuilder b=new StringBuilder();
    b.append(1)
     .append(2)
     .append(3);
}
}
StringBuilderDemo

 

package workhome;

public class WrapperDemo {
public static void main(String[] args) {
    Byte b=new Byte((byte)12);
    Short s= new Short((short)12);
    
    Long l=new Long(12);
    Boolean bb=new Boolean(true);
    long ll=11L;
    float f=12.3f;
    Integer.toHexString(100);
}
}
WrapperDemo

 

posted @ 2019-06-08 17:44  殇之弑梦  阅读(310)  评论(0编辑  收藏  举报