aspose file tools*
The moose likes Beginning Java and the fly likes Help needed with access specifiers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Help needed with access specifiers" Watch "Help needed with access specifiers" New topic
Author

Help needed with access specifiers

brahmjyot singh
Greenhorn

Joined: Jan 04, 2010
Posts: 1
This is probably more of a design question.

How would we use java access specifers in designing a real world class.Java textbooks tend to give a rather rigid definition
In short i am looking for a REAL example.
salvin francis
Ranch Hand

Joined: Jan 12, 2009
Posts: 928

It depends on a scenario,

usually i prefer to use private for all class instance variables,
protected for methods (mostly not variables) that can be accessed to same package
public for methods that can be accessed every where


My Website: [Salvin.in] Cool your mind:[Salvin.in/painting] My Sally:[Salvin.in/sally]
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40052
    
  28
And welcome to JavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help needed with access specifiers