Question: What does the following program segment do? (a) The first 5 member variables of myClass are copied to res. (b) The value of myClass.count is
What does the following program segment do?
(a) The first 5 member variables of myClass are copied to “res”.
(b) The value of myClass.count is set to 5.
(c) 5 copies of the myClass object are created.
(d) The number of MyClass fields described in “cl” is set to 5.
import java.lang.reflect. Field; MyClass my Class = new MyClass(); try { Class cl-Class.forName ("MyClass"); Field res-cl.getDeclaredField ("count"); res. set (myClass, "5"); } catch (Exception e) {}
Step by Step Solution
There are 3 Steps involved in it
b The v... View full answer
Get step-by-step solutions from verified subject matter experts
