what are the different access specifiers that can be used
by interfaces and abstract classes? can anyone give me
detailed description on this
Answers were Sorted based on User's Feedback
Answer / vishal arora
This question leads to two things
1. modifier for abstract class or interface
2. modifier for members of abstarct class or interface
For first in abstract class and interface we can have
public , protected and default and not private if it is top
level otherwise private also if it is nested
for point 2
in an interface every member variable is public and final
in an abstract class you can assign any modifier to member
variables
| Is This Answer Correct ? | 10 Yes | 0 No |
Answer / neha jain
i feel with interface we can use public and default.and
with abstract we can use all except private
| Is This Answer Correct ? | 10 Yes | 2 No |
Answer / lydia fernandes
Interface: Public or default
Abstract Class (Anything ) : public , private or Default
| Is This Answer Correct ? | 5 Yes | 0 No |
Answer / uday
Interface: Public or default
Abstract Class (Anything ) : public , private or Default
Iam sure about these answears
-uday
| Is This Answer Correct ? | 7 Yes | 3 No |
Answer / dhiren
public accsess specifier means it can publically accessed
by the class whether it's subclass of that class or present
in same packege or diffrent classes.
private access specifier is private to that class i.e. it
cant access out side the class
procted -it's accesesed by the sub class of the ckass
whether that present in the sane package or diffrent but it
must be a subclass
noacces accessed with in the same package
| Is This Answer Correct ? | 5 Yes | 3 No |
Answer / ismail
interface can be only public or default and abstract class
should be public protected
| Is This Answer Correct ? | 3 Yes | 1 No |
Answer / bhumika
interface can use public and default.and
abstract classes can use all of them including private.
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / malay tripathi
I guess if members of interface are declared final then
they can't be overridden & hence this hampers the logic
behind having interfaces...
Interface can only be Public/Default or abstract.In any
other case it can't be overridden & hence of no use.
MemberFunctions also behave similarly.
| Is This Answer Correct ? | 4 Yes | 3 No |
Answer / karishma
Interface default access specifier are public and Static
| Is This Answer Correct ? | 0 Yes | 0 No |
What are the advantages of autoboxing?
What is a treemap in java?
Are the equals() and hashCode() protected methods of object class?
What are static blocks and static initalizers in java ?
What is non static block in java
10 Answers Emphasis, Ness Technologies,
what's diff between struts 1.1 & 1.2
Why packages are used?
How do you relate a Interface to a Class? Tell me in Detail?
Is void a type?
What is type casting?
write a program to create an vector and listeterator.and value should be enter through keyboard.
What is better - 'bit-shift a value' or 'multiply by 2'?