Hi, You should change your methods accordingly to take benefit from your generic class declaration.Where you are writing Object as return type or parameter type in the Basket's methods, you should write E.
At runtime, there is no real difference between the two. Java generics work by type erasure: the compiler throws away the information about the parameterized type at compile time. Effectively generics are a compile-time only feature, just to check if you're not putting something in a collection that you shouldn't be putting in.
Doing something like this works without errors:
You will get a compiler error in the line where you are trying to put something in the basket:
Note: Test.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details.
You really shouldn't be doing something like "Basket basket = new Basket<Orange>();".