Play audio slide show -- Keyboard shortcut: 'x'  Back to slide -- Keyboard shortcut: 'u'  next        Play sound for this slide -- Keyboard shortcut: 'y'  MultidotDemo2.java - Et tilsvarende Java program som undgår brug af multidotning.Lecture 4 - slide 27 : 33
Program 2

public class MultidotDemo2{

  static C obj = new C(10);
  static C res, res1, res2;

  public static void main(String[] args){

    // res = obj.anotherC(5).anotherC(6).anotherC(7);

    res1 = obj.anotherC(5);
    res2 = res1.anotherC(6);
    res = res2.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));
 }

}