Mam interfejs z metodą foo
. W 1 klasie przyjmuje ta metoda argument Stringowy, a w 2 klasie nie przyjmuje żadnych argumentów. Jak to napisać?
Próbowałem np. tak:
public interface MyInterface<T> {
public void foo(T t);
}
public class MyImplementationClass implements MyInterface<String>{
@Override
public void foo(String x){
System.out.println(x);
}
}
public class MyImplementationClass2 implements MyInterface<null>{ // błąd!
@Override
public void foo(){ // błąd!
System.out.println("R najlepszy");
}
}