Hello all,
I am taking a sun practice exam for the
scjp 5. Please help me with the following question:
1. class x {
2. public static void main(
String [] args) {
3. String p = System.getProperty("x");
4. if(p.equals(args[1]))
5. System.out.println("found");
6. }
7. }
Which command-line invocation will produce the output found?
A
java -Dx=y x y z
B
java -Px=y x y z
C
java -Dx=y x x y z
D
java -Px=y x x y z
E
java x x y z -Dx=y
F
java x x y z -Px=y
I thought since we are comparing the property "x" to args[1] the correct answer is A, both would be y, however the exam says the answer is c. Please provide guidance.