Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Init.java
- package jason;
- public class Init {
- public static void main(String[] args) {
- new Son().action0().action1(); // action0, action1
- }
- }
- // Son.java
- package jason;
- public class Son {
- public Son action0(){
- System.out.println("action0");
- return this;
- }
- public Son action1(){ //public void action1(){}
- System.out.println("action1");
- return this;
- }
- }
- // Son.java (passing value)
- package jason;
- public class Son {
- int cup;
- public Son action0(int cup){
- this.cup = cup;
- return this;
- }
- public Son action1(){ //public void action1(){}
- System.out.println(cup);
- return this;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment