Explain the differences between public, private, protected
and static?
Answer Posted / manne ranjith
public-->inherite the protected members as preotected in
drived class and pubic members wiull be public in derived
class
protected--->pubic and protecated members of the base class
will become protected in derived class
Private-->pubilc and proteacted members will become private
in derived class
static--->Method is defined by static cannot access non-static
members or fields of that class. But non-static members can
access static fields or methods.
| Is This Answer Correct ? | 28 Yes | 32 No |
Post New Answer View All Answers
What is method with example?
What is a get method?
What is type safety in java?
When is the finally clause of a try-catch-finally statement executed?
Distinguish between a predicate and a function?
What is classpath?
What do you mean by pointer value and address?
What is difference between word and integer?
What is a finally block? Is there a case when finally will not execute?
What is the difference between inheritance and encapsulation?
What is the difference between a factory and abstract factory pattern?
How many bytes is a unicode character?
How many types of voids are there?
What is the default size of set in java?
What one should take care of, while serializing the object?