4th Jul 2017, 12:36 AM
esraa ragab
7 Answers
+ 1
you are trying to put the value v.val=78 in the System.out.println statement, that's why it's not putting any value to that variable, simply displaying 78. please refer to the code modified by me, hope this is the error we wanted to generate. v.val=78; System.out.println(val);
4th Jul 2017, 12:56 AM
akriti more
akriti more - avatar
+ 7
Not much a Java person but I think it's because you modify val inside the class itself, so there is no error assigning a value to it.
4th Jul 2017, 12:41 AM
Karl T.
Karl T. - avatar
+ 5
Private access means that it's restricted to the class itself.
4th Jul 2017, 12:56 AM
Karl T.
Karl T. - avatar
+ 1
but acess modifier is private
4th Jul 2017, 12:54 AM
esraa ragab
0
yes you are right it should print becouse in system.out and it dont change in variable
4th Jul 2017, 1:34 AM
esraa ragab
0
thank you
4th Jul 2017, 1:34 AM
esraa ragab
0
System .out.println(v.val); it gives the output...!
4th Jul 2017, 5:41 AM
I Am RG
I Am RG - avatar