title: Instantiating a Generic Interface
body: <p>I have an interface</p>
  
  <pre><code>public interface Foo&lt;T&gt; {
      public void bar(String s, T t);
  }
  </code></pre>
  
  <p>I want to write a method</p>
  
  <pre><code>public void baz() {
      String hi = "Hello";
      String bye = "Bye";
      Foo&lt;String&gt; foo = new Foo() {
          public void bar(String s, String t) {
              System.out.println(s);
              System.out.println(s);
          }
      };
      foo.bar(hi,bye);
  }
  </code></pre>
  
  <p>i get an error</p>
  
  <pre><code>&lt;anonymous Test$1&gt; is not abstract and does not override abstract method bar(String,Object) in Foo
      Foo&lt;String&gt; foo = new Foo() {
  </code></pre>
  
  <p>I'm fairly new to Java, I'm sure this is a simple mistake. how can I write this?</p>