Rectangle question

Douglas Ivers <[email protected]>
Newsgroups gmane.org.user-groups.trijug.juglist
Message-ID <[email protected]>
I noticed recently that Rectangle has public fields...

Rectangle r = new Rectangle();
r.x = 5;
r.y = 10;
int area = r.width * r.height;

Convenient to use, but bad design, right?
Under what scenarios does it make sense to break encapsulation like  
this in my own classes?  Never?  Single thread only?  Classes with no  
methods?  Only for primitives in which any/all values are acceptable?

If a primitive is declared public final, is this akin to a read-only  
field?

Thanks for any advice,
-Doug
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.