• Post Reply Bookmark Topic Watch Topic
  • New Topic

java access modifiers  RSS feed

 
ml behra
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone!!
I have got a very basic doubts.
1. what is the difference between public and default modifiers.
2. what are access specifiers.Access modifiers are:
public,private,default,protected,abstract,final,static,synchronize,transient and native.
But what are access specifiers.Are both(modifiers and specifiers) same?
 
pat patel
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To declare public means to give access to all classes, default access modifier limits access to inner classes, and subclasses.
 
deekasha gunwant
Ranch Hand
Posts: 396
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ml,
public access -
class can be accessed by any other class.
default access -
class can be accessed/used only inside the package in which it is defined

Now
public,private,default,protected,abstract,final,static,synchronize,transient and native .... all these metioned by u are called modifiers.
but out of these only public/protected/private are known as access modifiers/access specifiers.rest are simply modifiers.
regards
Deekasha
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!