[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/CSapprenticeWT/OnJava8-Examples/master/generics/Manipulation.java [Back]  [Original]

// generics/Manipulation.java
// (c)2021 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information.
// {WillNotCompile}

class Manipulator {
  private T obj;
  Manipulator(T x) { obj = x; }
  // Error: cannot find symbol: method f():
  public void manipulate() { obj.f(); }
}

public class Manipulation {
  public static void main(String[] args) {
    HasF hf = new HasF();
    Manipulator manipulator =
      new Manipulator(hf);
    manipulator.manipulate();
  }
}

Web Proxy Viewer  |  New URL  |  Original Page