-2

I had one interface:

 public interface DefaultInterface<T> {
    T doSomething(Integer id, T t);
}

And i have one implementation class:

 public class Example implements DefaultInterface{

    public ObjectOne doSomething(Integer id, ObjectOne objectOne) {
        return new ObjectOne();
    }
}

The Interface doesn't recognize implementation class with equal class in Return and parameter

What is wrong with my implementation?

Drew Pesall
  • 179
  • 3
  • 12
  • Please always include the full error message. Otherwise we have to guess or randomly spot the issue. – Zabuzard Nov 21 '19 at 19:21

1 Answers1

3

You need to tell what T is

public class Example implements DefaultInterface<ObjectOne> {

    public ObjectOne doSomething(Integer id, ObjectOne objectOne) {
        return new ObjectOne();
    }
}
Joakim Danielson
  • 43,251
  • 5
  • 22
  • 52