Consider the following application:
1. public class Main { 2. public static void main(String args[]) { 3. double d = 12.3; 4. MyClass dec = new MyClass(); 5. dec.decrement(d); //from w w w . ja v a 2s . c om 6. System.out.println(d); 7. } 8. } 9. 10. class MyClass { 11. public void decrement(double decMe) { 12. decMe = decMe - 1.0; 13. } 14. }
What value is printed out at line 6?
C.
The decrement()
method is passed a copy of the argument d; the copy gets decremented, but the original is untouched.