반응형
자격증/OCJP_ExamC2018. 7. 26. 17:56QUESTION 54

QUESTION 54 Given: 33. Date d = new Date(0); 34. String ds = "December 15, 2004"; 35. // insert code here 36. try { 37. d = df.parse(ds); 38. } 39. catch(ParseException e) { 40. System.out.println("Unable to parse " + ds); 41. } 42. // insert code here too What creates the appropriate DateFormat object and adds a day to the Date object? A. 35. DateFormat df = DateFormat.getDateFormat(); 42. d.se..

자격증/OCJP_ExamC2018. 7. 26. 17:38QUESTION 53

QUESTION 53 Given: 11. String test = "a1b2c3"; 12. String[] tokens = test.split("\\d"); 13. for(String s: tokens) System.out.print(s + " "); What is the result? A. a b c B. 1 2 3 C. a1b2c3 D. a1 b2 c3 E. Compilation fails. F. The code runs with no output. G. An exception is thrown at runtime. Solution : A

자격증/OCJP_ExamC2018. 7. 26. 17:30QUESTION 52

QUESTION 52 Given that c is a reference to a valid java.io.Console object, which two code fragments read a line of text from the console? (Choose two.) A. String s = c.readLine(); B. char[] c = c.readLine(); C. String s = c.readConsole(); D. char[] c = c.readConsole(); E. String s = c.readLine("%s", "name "); F. char[] c = c.readLine("%s", "name "); Solution : AE

자격증/OCJP_ExamC2018. 7. 26. 07:43QUESTION 51

QUESTION 51 Given: 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. Answer: D Section: All Explanation/Reference: Exception in thread "main" java...

자격증/OCJP_ExamC2018. 7. 26. 07:41QUESTION 50

QUESTION 50 Which three statements concerning the use of the java.io.Serializable interface are true? (Choose three.) A. Objects from classes that use aggregation cannot be serialized. B. An object serialized on one JVM can be successfully deserialized on a different JVM. C. The values in fields with the volatile modifier will NOT survive serialization and deserialization. D. The values in field..

자격증/OCJP_ExamC2018. 7. 26. 06:52QUESTION 49

QUESTION 49 Given: NumberFormat nf = NumberFormat.getInstance();nf.setMaximumFractionDigits(4);nf.setMinimumFractionDigits(2); String a = nf.format(3.1415926); String b = nf.format(2); Which two statements are true about the result if the default locale is Locale.US? (Choose two.) A. The value of b is 2. B. The value of a is 3.14. C. The value of b is 2.00. D. The value of a is 3.141. E. The val..

반응형
image