In the top stackoverflow answer to this question (Why are instance variables in Java always private?), someone said if you have the following class with a private string,
class Address {
private String phone;
}
then you can't modify the private string using the following code, but I tried it and it works.
// main method
Address a = new Address();
a.phone="001-555-12345";
He said you had to use a setter method, but I did it without using one.
I think I misinterpreted his answer, but I'm not sure how. I would appreciate any insight, thanks.