Suppose I have the following generic classes;

Queue<T>
KellysCoffee
CheckOut

and the following generic interfaces

QueueInterface
OrderLineInterface

Suppose I want KellysCoffee to extend Queue class and implement OrderLineInterface
This is how I've done it

private class KellyCoffee<Order extends Queue<Order>> implements OrderLineInterface{}

Now when I try to implement CheckOut

public class CheckOut<Order> extends KellysCoffee<Order>{}

I get a bound mismatch error saying

The type Order is not a vlaid substitute for the bounded parameter <Order extends Queue<Order>> of the type KellysOrder<Order>

when I try to extend KellyCoffee

Is there a way to fix this?

Hi,

private class KellyCoffee<Order> extends Queue implements OrderLineInterface

Otherwise, the declaration seems wrong : a class can't extend herself.

That yeilds the following error:

The interface QueueInterface cannot be implemented more than once with different arguments: QueueInterface<Order> and QueueInterface<Order>

Emphasized Text Here

Fixed it. More on the solution later.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.