如此之难的代码,有待你的题解,多谢
请您详细的写一下如下代码的题解
public static void main(String[] args) {
// TODO Auto-generated method stub
TreeSet treeSet = new TreeSet();
Scanner scanner = new Scanner(System.in);
// scanner.useDelimiter("\n");
while (scanner.hasNextInt()) {
int i = scanner.nextInt();
if (i == -1) {
scanner.close();
break;
} else {
treeSet.add(i);
}
}
Iterator iterator = treeSet.iterator();
System.out.println(treeSet);
while (iterator.hasNext()) {
Integer a = iterator.next();
if ((Math.sqrt(a) % 1) == 0) {
System.out.println(a "是平方数");
}
}
}
#Java工程师##笔试题目#