2

I'm just starting out with Netbeans and I ran into a problem trying to write a new class.

public class DeliveryList<T> extends ArrayList<T>
{
    public DeliveryList<T> // <identifier> expected
    {
    }
}

Netbeans throws this error at me and I'm not quite sure what to do.

1 Answer 1

3

Try this - read Java generics tutorial pages.

class DeliveryList<T> extends ArrayList<T>
{
  public <T>DeliveryList() {}
}
Sign up to request clarification or add additional context in comments.

2 Comments

Oh wow. Forgot to add parentheses. Can you explain why putting the generic before the name makes it work though? I tried it the other way but no dice.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.