Pick the correct option: class sample { int i, j; public void setdata(int ii, int jj) { this.i = ii; this.j = jj } } class myprogram { static void main(string[ ] args) { sample s1 = new sample(); s1.setdata(10, 2); sample s2 = new sample(); s2.setdata(5, 10); } }
a. the code will not compile since we cannot explicitly use 'this'.
e. contents of 'this' will be different during each call to setdata().
c. the call to setdata() is wrong since we have not explicitly passed the this reference to it.
d. the definition of setdata() is wrong since we have not explicitly collected the 'this' reference.
b. using 'this' in this program is necessary to properly set the values in the object.
Answers
Answered by
0
option a is the write answer
Similar questions