Given 33 Date d new Date0 34 String ds 35 insert code here36

Given 33 date d new date0 34 string ds 35 insert code

This preview shows page 47 - 51 out of 102 pages.

Question 107 Given:33. Date d = new Date(0);34. String ds = “December 15, 2004”;35. // insert code here36. try {37. d = df.parse(ds);
Background image
42. // insert code here tooWhich will create the appropriate DateFormat object and add a day tothe Date object? Question 108Given a valid DateFormat object named df, and16. Date d = new Date(0L);17. String ds = “December 15, 2004”;18. // insert code hereWhat updates d’s value with the date represented by ds? Question 109Given:11. String test = “This is a test”;12. String[] tokens = test.split(”\s”);13. System.out.println(tokens.length);What is the result? A. 0B. 1C. 4D. Compilation fails.E. An exception is thrown at runtime. Question 110 Given: 11. String test= “a1b2c3”;
Background image
12. String[] tokens = test.split(”\\d”);13. for(String s: tokens) System.out.print(s +“ “);What is the result? Question 111Given:11. String test = “Test A. Test B. Test C.”;12. // insert code here13. String[] result = test.split(regex);Which regular expression inserted at line 12 will correctly split test into“Test A,” “Test B,” and “Test C”? Question 112Given:12. System.out.format(”Pi is approximately %d.”, Math.PI);What is the result? Question 113Given: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? A. Compilation fails.B. After line 15, the value of age is 5. C. After line 15, the value of age is 3. D. An exception is thrown at runtime.
Background image
Question 114Which two code fragments will execute the method doStuff() in aseparate thread? (Choose two.)
Background image
Image of page 51

You've reached the end of your free preview.

Want to read all 102 pages?

  • Fall '15
  • Muler
  • Madrid Metro, Metropolitana di Napoli, class a, Osaka Municipal Subway, public class, public static void

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture