private and protected

private and protected

what is diffrence between private and protected ?

View Answers

November 14, 2011 at 4:20 PM

A private (variable, method or class) is only accessible in the class where it was declared while A protected (variable,method or class) is accessible to sub classes and classes in the same package as where they were declared.

Ads









Related Tutorials/Questions & Answers:
private and protected
private and protected  what is diffrence between private and protected
What do you understand by private, protected and public?
What do you understand by private, protected and public?   Hi, What do you understand by private, protected and public? thanks
Advertisements
In Java, what's the difference between public, default, protected, and private?
In Java, what's the difference between public, default, protected, and private?  In Java, what's the difference between public, default, protected, and private
Using Protected Access in JSP
specifiers: public, protected, private. We always declare access specifiers to be more accessible. That means we have declared anything as a private, then we can...Using Protected Access in JSP     
ModuleNotFoundError: No module named 'protected'
ModuleNotFoundError: No module named 'protected'  Hi, My Python... 'protected' How to remove the ModuleNotFoundError: No module named 'protected' error? Thanks   Hi, In your python environment you
Can a class be declared as protected?
Can a class be declared as protected?  Hi, Can a class be declared as protected? thanks   Hi, A class can't be declared as protected. only methods can be declared as protected. http://www.roseindia.net/java
java protected variables
java protected variables   Can we inherit the Java Protected variable..?   of course you can. But I think what you mean is "override"? Is tha so? There are some restriction
private constructor
private constructor  can we extend from a class which is having private constuctor
What is the access scope of a protected method?
What is the access scope of a protected method?  Hi, What is the access scope of a protected method? thanks   Hi, In Java program, A protected method can be accessed by the classes within the package
Protected Java Keyword
Protected Java Keyword       protected is a keyword defined in the java programming language. Keywords... in java programming language likewise the protected keyword indicates
private method
private method  how can define private method in a class and using it in another class in a same package? my source code: class rectangle{ int...){ this.length=l; this.breadth=b; } private int calculate
private method
private method  how can define private method in a class and using it in another class in a same package? my source code: class rectangle{ int length,breadth; void show(int length,int bredth){ this.length=length
ModuleNotFoundError: No module named 'django-protected-files'
ModuleNotFoundError: No module named 'django-protected-files'  Hi...: No module named 'django-protected-files' How to remove the ModuleNotFoundError: No module named 'django-protected-files' error? Thanks   Hi
ModuleNotFoundError: No module named 'django-protected-files'
ModuleNotFoundError: No module named 'django-protected-files'  Hi...: No module named 'django-protected-files' How to remove the ModuleNotFoundError: No module named 'django-protected-files' error? Thanks   Hi
ModuleNotFoundError: No module named 'django-protected-media'
ModuleNotFoundError: No module named 'django-protected-media'  Hi...: No module named 'django-protected-media' How to remove the ModuleNotFoundError: No module named 'django-protected-media' error? Thanks   Hi
Private Cloud Hosting
Private Cloud Hosting  Hi, What is Private Cloud Hosting? What are the benefits of Private Cloud Hosting? Thanks
private static final
private static final  Why there is necessary to make a variable private static final
udacity secure and private ai
udacity secure and private ai  Hi, I am beginner in Data Science... secure and private ai Try to provide me good examples or tutorials links so that I can learn the topic "udacity secure and private ai". Also tell me
Private Java Keyword
Private Java Keyword       private is a keyword defined in the java programming language. Keywords... in java programming language likewise the private keyword indicates the following
ModuleNotFoundError: No module named 'base-private'
ModuleNotFoundError: No module named 'base-private'  Hi, My Python... 'base-private' How to remove the ModuleNotFoundError: No module named 'base-private' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'kjkiss-private'
ModuleNotFoundError: No module named 'kjkiss-private'  Hi, My... named 'kjkiss-private' How to remove the ModuleNotFoundError: No module named 'kjkiss-private' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'mediagoblin-private'
ModuleNotFoundError: No module named 'mediagoblin-private'  Hi, My... named 'mediagoblin-private' How to remove the ModuleNotFoundError: No module named 'mediagoblin-private' error? Thanks   Hi
ModuleNotFoundError: No module named 'mediagoblin-private'
ModuleNotFoundError: No module named 'mediagoblin-private'  Hi, My... named 'mediagoblin-private' How to remove the ModuleNotFoundError: No module named 'mediagoblin-private' error? Thanks   Hi
ModuleNotFoundError: No module named 'private-pypi'
ModuleNotFoundError: No module named 'private-pypi'  Hi, My Python... 'private-pypi' How to remove the ModuleNotFoundError: No module named 'private-pypi' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'PyTestGame_private'
ModuleNotFoundError: No module named 'PyTestGame_private'  Hi, My... named 'PyTestGame_private' How to remove the ModuleNotFoundError: No module named 'PyTestGame_private' error? Thanks   Hi, In your
What if the main() method is declared as private?
What if the main() method is declared as private?  Hi, What if the main() method is declared as private? Thanks   Hi, I have found... as private. Visit this link may help you for getting examples with syntax related
private equity data science jobs
private equity data science jobs  Hi, I am beginner in Data Science...: private equity data science jobs Try to provide me good examples or tutorials links so that I can learn the topic "private equity data science jobs"
ModuleNotFoundError: No module named 'django-private-chat'
ModuleNotFoundError: No module named 'django-private-chat'  Hi, My... named 'django-private-chat' How to remove the ModuleNotFoundError: No module named 'django-private-chat' error? Thanks   Hi
ModuleNotFoundError: No module named 'django-private-files'
ModuleNotFoundError: No module named 'django-private-files'  Hi...: No module named 'django-private-files' How to remove the ModuleNotFoundError: No module named 'django-private-files' error? Thanks   Hi
ModuleNotFoundError: No module named 'django-private-files-0.1.2'
ModuleNotFoundError: No module named 'django-private-files-0.1.2'  Hi...: No module named 'django-private-files-0.1.2' How to remove the ModuleNotFoundError: No module named 'django-private-files-0.1.2' error? Thanks
ModuleNotFoundError: No module named 'django-private-media'
ModuleNotFoundError: No module named 'django-private-media'  Hi...: No module named 'django-private-media' How to remove the ModuleNotFoundError: No module named 'django-private-media' error? Thanks   Hi

Ads