-2

In this line

public TreeSet<int> storage = new TreeSet<int>();

I get the following error when I try to compile:

error: unexpected type

public TreeSet<int> storage = new TreeSet<int>();

What do I need to do to fix this?

Tunaki
  • 132,869
  • 46
  • 340
  • 423
chef
  • 21
  • 2

1 Answers1

0

Generics enable types (classes and interfaces) to be parameters when defining classes, interfaces and methods. So, parameters SHOULD not be primitive.

Change it to,

TreeSet <Integer> storage = new TreeSet<>();
             (or)
Set <Integer> storage = new TreeSet<>();
Kris
  • 1,618
  • 1
  • 13
  • 13