Shav Shav - 2 months ago 14
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?


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.