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