单项选择题
11. public void addStrings(List list) { 12. list.add(”foo”); 13. list.add(”bar”); 14. } What must you change in this method to compile without warnings?()
12. String csv = “Sue,5,true,3”; 13. Scanner scanner = new Scanner( csv); 14. scanner.useDelimiter(”,”); 15. int age = scanner.nextInt(); What is the result?()
class Computation extends Thread { private int num; private boolean isComplete; private int result; public Computation(int num) { this.num = num; } public synchronized void run() { result = num * 2; isComplete = true; notify(); } public synchronized int getResult() { while (!isComplete) { try { wait(); } catch (InterruptedException e) { } } return result; } public static void main(String[] args) { Computation[] computations = new Computation [4]; for (int i = 0; i < computations.length; i++) { computations[i] = new Computation(i); computations[i] .start(); } for (Computation c : computations) System.out.print(c.getResult() +“ “); } } What is the result?()
Which code, inserted at line 15, creates an instance of the Point class defined in Line?()
public class X { public static void main (String args) { byte b = 127; byte c = 126; byte d = b + c; } } Which statement is true?()
Which code, inserted at line 4, guarantees that this program will output [1, 2]?()
多项选择题
public class OuterClass { private double d1 1.0; //insert code here } You need to insert an inner class declaration at line2. Which two inner class declarations are valid?()
What is the result?()
赞题库-搜题找答案
(已有500万+用户使用)
无需下载 立即使用
版权所有©考试资料网(ppkao.com)All Rights Reserved