有以下類定義:
public class Test> {
public Test(){
System.out.println("success");
}
}
請問各位如何創建實例?
PS:
Test> test=new Test>();
是不行的
/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
class Test<U,V extends Test<U,V>> {
public Test(){
System.out.println("success");
}
}
class A extends Test<String, A>
{
}
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Test<String, A> t = new Test<String, A>();
}
}