我想知道为什么这段代码会出现编译错误。我是 JAVA 的新手。我想像在 C++ 中一样制作一组对内部类代码中的对是什么意思
import java.io.*;
import java.util.Set;
public class UVa {
public static boolean flag = false;
public static Integer p0, p1;
public static Set<pair<Integer,Integer> > sorter;
public static class pair<first,second>{
public first First;
public second Second;
private pair(first First,second Second){
this.First = First;
this.Second = Second;
}
}
public static void main(String[] args) {
try {
while (true) {
p0 = System.in.read();
p1 = System.in.read();
sorter.add(pair<p0, p1>); //<<Syntax error on token ">", Expression expected after this token
}
} catch (IOException e) {
System.out.println(e.toString());
}
}
}