Shav Shav - 1 year ago 86
C# Question

Java Templates, how to use two classes with the same name and different types

I have problem with templates in Java. I don't know what is wrong. I pasted the code from C# to Java and does not work.

class A<T1, T2>

class A<T1, T2, T3>

What's wrong?

Answer Source

You cannot have two outer classes with the same name in the same package. Try renaming one of the classes or put it in a different package. Alternatively putting one class as a nested class of another class would also work, but the question is if they really need to have the same name.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download