0
Why this code dont give error?
7 Respuestas
+ 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);
+ 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.
+ 5
Private access means that it's restricted to the class itself.
+ 1
but acess modifier is private
0
yes you are right it should print becouse in system.out and it dont change in variable
0
thank you
0
System .out.println(v.val);
it gives the output...!