Java multi “where” keyword?

How to limit 2 generic types in a class definition? How should I "where t:" twice?

public class MyClass<T,S> where T: Simplex,where S: Complex
{
...
}

? Or did I do something wrong? Where can I find this document? Google's search for "Java keywords, where generics" doesn't really help: where is a very common word... I can't find it in the Java trail of generics

Solution

I believe this is the grammar you are looking for:

public class MyClass<T extends Simplex,S extends Complex> { }

For more information, see this Java tutorials page

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>