Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A method can make permanent changes to the contents of parameter of type char. F

ID: 3868230 • Letter: A

Question

A method can make permanent changes to the contents of parameter of type char. For example, the following assignment will be visible by the caller of foo (): public static void foo (char c) { c = 'f': } A) TRUE B) FALSE A method can make permanent changes to the contents of parameter of type char []. For example, the following assignment will be visible by the caller of foo (): public static void foo (char[] c) { c[0] = 'f': } (A) TRUE B) FALSE A method can make permanent changes to the contents of parameter of type String. For example, the following assignment will be visible by the caller of foo (): public static void foo (String s) { s = "bar": } A) TRUE B) FALSE

Explanation / Answer

1. Answer is false
   The value won't be visible to the caller.Parameter is passed by value

2. Answer is true
   The value will be visible to the caller. Arrays are always passed with address.The parameter c is refering to the same array

3.Answer is False
The value won't be visible to the caller. s parameter referes to a copy of the passed string s.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote