Java Reference
In-Depth Information
A. Line 8 throws a ParseException because ”19” is not a valid month.
B. Line 8 generates a compiler error.
C. Line 8 successfully parses the String s into a java.util.Date object that represents
October 19, 1987.
D. The U.S. locale does not support the SHORT date style.
E. The output is a long that represents the number of milliseconds from January 1, 1970
to October 19, 1987.
21. Given the following code:
Pattern p = Pattern.compile(“x.y”);
String [] values = {“xy”, “xay”, “xaby”, “xa”};
for(String value : values) {
if(p.matcher(value).matches()) {
System.out.println(value);
}
}
which of the following strings is output? (Select one.)
A. xy
B. xay
C. xaby
D. xa
E. None of the above
22. What is the output of the following code?
3. String stuff = “of coursewyeswnowmaybe”;
4. String [] values = stuff.split(“w”);
5. System.out.println(values.length);
A. 0
B. 3
C. 4
D. 5
E. A NullPointerException is thrown.
23. What is the result of the following code?
3. Pattern pattern =
4. Pattern.compile(“(\\d[a-z])+\\s\\w?”);
5. String [] values = {“9a4b x”, “3a z”, “a”, “1a2b3c “};
6. int counter = 0;
Search WWH ::




Custom Search