Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Why non nested classes in java are not having marked as
protected access specifier

Answer Posted / udita bose

Sorry, but previous answer by Yayati Pavan does not answer the question. If that answer is true then there should not be a problem with a "protected" class, as "protected" keyword is wider than default one.

There are no protected class because it is unnecessary to have them. Access modifiers for classes determine 2 things

i) If a class can create instance of other class ?
ii)If a class can extend other class ?

Now, any class within the same package will be able to create an instance of "protected" class - this is true for default-accessor and public classes. No class outside the package will be able to create an instance of "protected" class - this holds good for default-accessor classes.

Again, for a "protected" class by its definition will be extendible by any class within its package - so is default-accessor class, and extendible for any class outside its package - so are all public classes.

Both of this reason nullifies the reason for a protected class.

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are basic data types?

1089


What is the basic concept of java?

1007


What does @param args mean in java?

1051


What do you understand by overloading and overriding in java?

1071


Can we declare register variable as global?

927


Why are lists ordered in java?

1009


Explain the importance of finally block in java?

954


Can classes declared using the abstract keyword cab be instantiated?

1042


When is the garbage collection used in Java?

1195


Write code to implement bubble sort in java?

991


What is a linkedhashmap java?

994


What are the practical benefits, if any, of importing a specific class rather than an entire package (e.g. Import java.net.* Versus import java.net.socket)?

1110


What is meant by attribute?

1107


What does nullpointerexception mean?

1078


What is void keyword?

1097