Answer: Scanner : Questions « Utility Classes « SCJP

1 2 Exception in thread "main" java.util.InputMismatchException
	at java.util.Scanner.throwFor(
	at java.util.Scanner.nextInt(
	at java.util.Scanner.nextInt(
	at MainClass.main(

8.31.1.Which collection allows you to grow or shrink its size and provides indexed access to its elements, but whose methods are not synchronized?
8.31.2.Answer: collection
8.31.3.What is the result(PriorityQueue)?
8.31.4.Answer: PriorityQueue
8.31.5.What is the output(TreeSet and sub set)?
8.31.6.Answer: TreeSet and sub set
8.31.7.What is the output(TreeMap and ceiling keys)?
8.31.8.Answer: TreeMap and ceiling keys
8.31.9.Which, inserted independently at line 9, will compile? (Choose all that apply.)
8.31.10.Answer: generic and hierarchy
8.31.11.What is the result(TreeSet)?
8.31.12.Answer: TreeSet and class hierarchy
8.31.13.What is the output(implements Comparator)?
8.31.14.Answer: implements Comparator
8.31.15.Instances of which class(es) can be serialized?
8.31.16.Answer: serizlizable objects
8.31.17.What is the output(NumberFormat)?
8.31.18.Answer: NumberFormat
8.31.19.What is the result(pattern matching)?
8.31.20.Answer: pattern matching
8.31.21.What is the result(Scanner)?
8.31.22.Answer: Scanner
8.31.23.Which of the following suggested changes will allow the method to compile?
8.31.24.Answer: Boolean and if statement
8.31.25.You must initialize java.lang.System class if you want to use the System.err output(True/False).
8.31.26.Answer: java.lang.System
8.31.27.The System.arraycopy method works only with arrays of primitives(True/False).
8.31.28.Answer: System.arraycopy method
8.31.29.The System.exit method takes an int primitive parameter(True/False).
8.31.30.Answer: System.exit method
8.31.31.There is a Runtime method to request that the JVM start garbage collection(True/False).
8.31.32.Answer: Runtime method
8.31.33.long avail = Runtime.getRuntime().freeMemory() returns the approximate amount of free memory available to the JVM(True/False)
8.31.34.Answer: Runtime.getRuntime().freeMemory()
8.31.35.A Vector can hold object references or primitive values(True/False).
8.31.36.Answer: Vector and primitive values
8.31.37.A Vector maintains object references in the order they were added(True/False).
8.31.38.Answer: Vector and inserted order