标签:删除 int 8K tps ubunt 位置 set hash 不可
连接数据库
查询操作
代码托管:
....教材代码我全部是copy到Ubuntu上的,没用idea跑,所以用idea做了一下第三章的课后练习
1.选项:cd
import java.util.*; import java.util.ArrayList; public class Exercise9411 { public static void main(String[] args) { foreach(new HashSet()); foreach(new ArrayList()); } private static void foreach(Collection ## ##elements) { for(Object o : elements) { } } }
分析:
2.选项 :A
import java.util.*; //import java.util.ArrayList; public class Exercise9412 { public static void main(String[] args) { foreach(new HashSet() { }); } private static void foreach(Iterable iterable) { for(Object o : iterable) { } } }
分析:
3.选项:C
import java.util.*; public class Exercise9413 { public static void main(String[] args) { foreach(new HashSet()); } private static void foreach(Collection collection) { Iterator elements = collection.iterator(); while(elements.hasNext()) { System.out.println(elements.next()); } } }
分析:
4.选项:D
import java.util.*; class Student5212 { String number; String name; int score; Student5212(String number, String name, int score) { this.number = number; this.name = name; this.score = score; } } public class Exercise5212 { public static void main(String[] args) { Set<Student5212> students = new TreeSet<>(); students.add(new Student5212("B1234", "Justin", 90)); students.add(new Student5212("B5678", "Monica", 100)); foreach(students); } private static void foreach(Collection<Student5212> students) { for(Student5212 student : students) { System.out.println(student.score); } } }
分析:
5。选项:D
import java.util.*; class Student123 { String number; String name; int score; Student123(String number, String name, int score) { this.number = number; this.name = name; this.score = score; } } public class Exercise123 { public static void main(String[] args) { Set<Student123> students = new HashSet<>(); students.add(new Student123("B1234", "Justin", 90)); students.add(new Student123("B5678", "Monica", 100)); students.add(new Student123("B1234", "Justin", 100)); students.add(new Student123("B5678", "Monica", 98)); students.add(new Student123("B5678", "Monica", 100)); System.out.println(students.size()); } }
6.选项:A
import java.util.*; public class Exercise122 { public static void main(String[] args) { Set<Integer> numbers = new TreeSet<>(); numbers.add(1); numbers.add(2); numbers.add(1); numbers.add(3); foreach(numbers); } private static void foreach(Collection<Integer> numbers) { for(Integer number : numbers) { System.out.println(number); } } }
8.选项C
import java.util.*; public class Exercise111 { public static void main(String[] args) { Set numbers = new TreeSet(); numbers.add(1); numbers.add(2); numbers.add(1); numbers.add(3); for(Integer number : numbers) { System.out.println(number); } } }
9.选项:C
import java.util.*; public class Exercise9987 { public static void main(String[] args) { Set<Integer> numbers = new TreeSet<>(); numbers.add(1); numbers.add(2); numbers.add(1); numbers.add(3); for(Integer number : numbers) { System.out.println(number); } } }
10.选项:CD
import java.util.*; public class Exercise110 { public static void main(String[] args) { Map<String, String> messages = new HashMap<>(); messages.put("Justin", "Hello"); messages.put("Monica", "HiHi"); foreach(messages.values()); } private static void foreach(Iterable<String> values) { for(String value : values) { System.out.println(value); } } }
感想:IEDA是个好东西,可是快到期了,当初脱壳...电脑还给整崩了。用ieda跑亲眼看到那些错误提示,很有感觉,自己手动敲一遍的东西印象深很多——知道怎么错的,有些东西不仅要能正确调试,知道错因也很重要。之前教材内容学的比较水,以后我会挨个用ieda练习每一章练习题夯实基础..
标签:删除 int 8K tps ubunt 位置 set hash 不可
原文地址:https://www.cnblogs.com/FenixRen/p/8849705.html