Given: 1.d is a valid, non-null Date object 2.df is a valid, non-null DateFormat object set to the current locale What outputs the current locale’s country name and the appropriate version of d’s date?()
A、Locale loc = Locale.getLocale(); System.out.println(loc.getDisplayCountry()+ + df.format(d));
B、Locale loc = Locale.getDefault(); System.out.println(loc.getDisplayCountry()+ + df.format(d));
C、Locale loc = Locale.getLocale();System.out.println(loc.getDisplayCountry()+ + df.setDateFormat(d));
D、 Locale loc = Locale.getDefault();System.out.println(loc.getDisplayCountry()+ + df.setDateFormat(d));
相关问题推荐
-
1. package foo; 2. 3. import java.util.Vector; 4. 5. private class MyVector extends Vector { 6. int i = 1; 7. public MyVector() { 8. i = 2; 9. } 10. } 11. 12. public class MyNewVector extends MyVector { 13. public MyNewVector () { 14. i = 4; 15. } 16. public static void main (String args []) { 17. MyVector v = new MyNewVector(); 18. } 19. } The file MyNewVector.java is shown in the exhibit. What is the result?()
A、 Compilation will succeed.
B、 Compilation will fail at line 5.
C、 Compilation will fail at line 6.
D、 Compilation will fail at line 14.
E、 Compilation will fail at line 17.
-
Integer i = new Integer (42); Long 1 = new Long (42); Double d = new Double (42.0); Which two expressions evaluate to True? ()
A(i ==1)
B(i == d)
C(d == 1)
D(i.equals (d))
E(d.equals (i))
F(i.equals (42))
-
class A { public byte getNumber() { return 1; } } class B extends A { public short getNumber() { return 2; } public static void main(String args[]) { B b = new B(); System.out.println(b.getNumber()); } } What is the result?()
A、 1
B、 2
C、 An exception is thrown at runtime.
D、 Compilation fails because of an error in line 8.
E、 Compilation fails because of an error in line 14.
-
public class Team extends java.util.LinkedList { public void addPlayer(Player p) { add(p); } public void compete(Team opponent) { /* more code here */ } } class Player { /* more code here */ } Which two are true?()
AThis code will compile.
BThis code demonstrates proper design of an is-a relationship.
CThis code demonstrates proper design of a has-a relationship.
DA Java programmer using the Team class could remove Player objects from a Team object.
-
What is the result?()
A、 23
B、 234
C、 235
D、 2345
E、 2357
F、 Compilation fails.