Stop show with sound  Next slide in show -- Keyboard shortcut: 'n'  1 minute, 48 secondsLecture 4 - slide 27 : 33
Program 1
public class MultidotDemo1{

  static C obj = new C(10);
  static C res;

  public static void main(String[] args){

    res = obj.anotherC(5).anotherC(6).anotherC(7);
    System.out.println(res);

  }

}


class C{

 int state;

 public C(int i){
   state = i;
 }

 public C anotherC(int i){
   return(new C(this.state + i));
 }

 public String toString(){
   return(Integer.toString(state));
 }

}