Given:
import java.text.DateFormat; public class Main { public static void main(String[] args) { DateFormat df1 = DateFormat.getInstance(); DateFormat df2 = DateFormat.getInstance(DateFormat.SHORT); DateFormat df3 = DateFormat.getDateInstance(DateFormat.FULL); DateFormat df4 = DateFormat.getDateInstance(DateFormat.EXTENDED); }/*from w w w. java 2 s .c o m*/ }
Which are true? (Choose all that apply.)
B, D, and F are correct.
The DateFormat class is in the java.text package.
The getInstance()
method takes no arguments, and it uses the SHORT style by default.
There is no such style as EXTENDED.
Note: We agree that this is largely a memorization question.
For the most part the exam doesn't tend to be so memorization intensive, but this objective tends to be more so.
Take the perspective that once you're done you can forget the details, and later on, when you're using these classes in practice, you'll have that nagging sensation that there are in fact a couple of gotchas
in the API.