I had an interview days ago and was thrown a question like this.
Q: Reverse a linked list. Following code is given:
public class ReverseList {
i
You cannot create an instance (/object ) of an Interface. Yes, you can pass Interface as a parameter in the function. But the question seems incomplete. Interface isn't implemented by any class. Something is missing. If you try to run this, compiler will not show any error.
But, in the reverse() method you need to create an instance of class that implements NodeList interface. I hope this makes sense.