我有2类:链接方式,方法
public class A {
private final List<String> list;
public A() {
list = new ArrayList<String>();
}
public A first(String s) {
list.add(s);
return this;
}
public A second() {
System.out.println(list);
return this;
}
}
public class B extends A {
public B bfisrt() {
System.out.println("asd");
return this;
}
}
,并在主要的工作与主,下面的代码类
B b = new B();
b.first("unu")
.second();
b.bfirst();
,但我想要在同一个对象上链接两个类的方法。这是可行的吗?像
B b = new B();
b.first("unu")
.second()
.bfisrt();
也尝试一下,看看它有可能.. – nafas