标签:show isp none OLE int alt closed div home
package workhome; public class BuilderDemo { public static void main(String[] args) { //builder模式 //方法链编程 Person1 p = new Person1() .setName("tom") .setAge(12) .setSex("女"); } }
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; } }
package workhome; public class StringBuilderDemo { public static void main(String[] args) { StringBuilder b=new StringBuilder(); b.append(1) .append(2) .append(3); } }
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); } }
标签:show isp none OLE int alt closed div home
原文地址:https://www.cnblogs.com/King-boy/p/10991240.html