Let say I have a private instance variable in a Java code.
Is there any direct/indirect way to retrieve or set its value from other classes.Code:class SetName
{
private String Name;
// rest of the code goes here
}
Printable View
Let say I have a private instance variable in a Java code.
Is there any direct/indirect way to retrieve or set its value from other classes.Code:class SetName
{
private String Name;
// rest of the code goes here
}
Indirect, yes: define a setter. But the whole point of private variables is that they can't be accessed from other classes.
How about the methods such as void, no return value.
What's the question?
I mean how can work on such a variable on a method like void which has no return value.
the void methods are used to manipulate the private instance variables of the class
How poor I'm to miss this point. Thanks