wood burning stoves 2.0*
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Help needed with access specifiers" Watch "Help needed with access specifiers" New topic

Help needed with access specifiers

brahmjyot singh

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: 917

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

Joined: Oct 13, 2005
Posts: 38045
And welcome to JavaRanch
wood burning stoves
subject: Help needed with access specifiers
Similar Threads
What is the best data base to use?
Does Scjp1.4 test AWT and IO?as I know AWT and IO will not be tested?Is it real?
Sun to fire 3,000 employees
New way to attract indian techies
Complete SCEA 5 Exam Survey /Free exam voucher $200 US Value