aspose file tools*
The moose likes Beginning Java and the fly likes how public data member manipulated by outside world Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "how public data member manipulated by outside world" Watch "how public data member manipulated by outside world" New topic
Author

how public data member manipulated by outside world

Abdullah mohammad
Greenhorn

Joined: Feb 22, 2013
Posts: 3


please can some one give an example in which public data member of a class is manipulated by outside world
directly.
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

The java.awt.Point class (see API) has two public data members, x and y. You can directly manipulate them like this:


Steve
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39834
    
  28
Welcome to the Ranch
Look up the java.awt.Point class. Or java.awt.GridBagConstraints.
Of course, it is usually regarded as poor design to have public fields, unless they are constants. Point and GridBagConstraints do not escape being bad.
Abdullah mohammad
Greenhorn

Joined: Feb 22, 2013
Posts: 3
Steve Luke wrote:The java.awt.Point class (see API) has two public data members, x and y. You can directly manipulate them like this:



thank you Steve
 
Don't get me started about those stupid light bulbs.
 
subject: how public data member manipulated by outside world