To access a variable in a class in Java, is it better to return its value via a method, or just acces it via myClass.variable?
<p>I think that the title says it all.  Maybe I should ask:  Is it ever bad to not use a method to return the variable, or its value?  An example would be a 2-d point class with an x and a y variable.</p>

<p>Is there anything wrong with using <code>myPoint.x</code> to get the x variable of <code>myPoint</code> as opposed to <code>myPoint.xValue()</code>, which simply returns <code>mypoint.x</code>?</p>
