You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
831 B
54 lines
831 B
package maslaos.shejimos;
|
|
|
|
public class Person {
|
|
int a;
|
|
int b;
|
|
int c;
|
|
int d;
|
|
|
|
private Person(){
|
|
A a = new A(){};
|
|
|
|
}
|
|
static class PersonBuilder{
|
|
Person p =new Person();
|
|
|
|
PersonBuilder basic(int a,int b){
|
|
p.a=a;
|
|
p.b=b;
|
|
return this;
|
|
}
|
|
|
|
PersonBuilder c(int c){
|
|
p.c=c;
|
|
return this;
|
|
}
|
|
|
|
PersonBuilder d(int d){
|
|
p.d=d;
|
|
return this;
|
|
}
|
|
|
|
Person builder(){
|
|
return p;
|
|
}
|
|
|
|
}
|
|
|
|
abstract class A{
|
|
// abstract void m();
|
|
|
|
}
|
|
|
|
public static void main(String[] args) {
|
|
Person person = new PersonBuilder()
|
|
.basic(1, 2)
|
|
.c(3)
|
|
.d(4)
|
|
.builder();
|
|
|
|
|
|
}
|
|
|
|
}
|