This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Roundup Game Question #118 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Roundup Game Question #118" Watch "Roundup Game Question #118" New topic

Roundup Game Question #118

sanjay kanungo

Joined: Dec 06, 2000
Posts: 7
Question :
Can a method have more than one access modifier?
Answer :
How about public static or public native? The answer seems to assume only private, public, protected and default are access modifiers.
Please clarify.
Kirti Dhingra
Ranch Hand

Joined: Dec 13, 2000
Posts: 32
static or native are not access modifiers.
K Dhingra
Rajpal Kandhari
Ranch Hand

Joined: Aug 26, 2000
Posts: 126
Hello Sanjay,

Modifiers are Java keywords that gives the compiler information about the nature of code,
data, or classes. Modifiers are:
From the above list of modifiers public, proteted and private are access modifiers. Remaining
modifiers do not fall in this category.

Note: default is a keyword in Java but it is not Access Modifier and "friendly" is not a
keyword in Java.
Normally when people talk in Java about class, data, methods which don't have any access modifier
they say that it has a defalut access modifier. The use of word default here is incoerrect. As default
is a keyword in Java. Instead friendly word is used.
"Friendly is not a Java keywords; it is simple a name that is given the access level that result from
not specifying an access modifier." OR in other words
"Friendly is the name of the default access of classes, variables, and methods, if you don't
specify an access modifier."

Regards,<P>Raj.<BR>-------------------------<BR>Afforts should be Appriciated.<BR>-------------------------
I agree. Here's the link:
subject: Roundup Game Question #118
It's not a secret anymore!