Can you access private data fields without setter methods in Java?
<p>In the top stackoverflow answer to this question (<a href="https://stackoverflow.com/questions/7622730/why-are-instance-variables-in-java-are-always-private">Why are instance variables in Java always private?</a>), someone said if you have the following class with a private string,</p>

<pre><code>class Address {
  private String phone;

}
</code></pre>

<p>then you can't modify the private string using the following code, but I tried it and it works.</p>

<pre><code>// main method
Address a = new Address();
a.phone="001-555-12345";
</code></pre>

<p>He said you had to use a setter method, but I did it without using one.</p>

<p>I think I misinterpreted his answer, but I'm not sure how. I would appreciate any insight, thanks. </p>