private and protected

Ads

 
 

Share on Google+Share on Google+

santosh kumar
private and protected
1 Answer(s)      5 years and 11 months ago
Posted in : Java Beginners

what is diffrence between private and protected ?

Ads
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     
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
private constructor
private constructor  can we extend from a class which is having private constuctor
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 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
make a file password protected
make a file password protected  I am trying to write Java code for creating a file of any type (either text,csv,or any other format). What I need is : The file generated should be zipped and password-protected. When I try to open
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
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
Java private constructor
Java private constructor  what is private constructor?what are the uses of writing private constructor in our program
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
Private variable of class
Private variable of class  Hi..... What keyword allows you to refer to private variables of a class in flex? Please give me an example for that Thanks  Ans: private keyword and this keyword
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
private and final - Java Interview Questions
private and final  what is the difference between private modifier and final modifier in java   Hi Friend, Private modifier indicates... private protects the class writer from external code. Thanks
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
password protected zip file creation exmpale coded neaded - JSP-Servlet
password protected zip file creation exmpale coded neaded  am able to create a zip file and able to read the file but password protection need please help
Version of com.siftscience>sift-android-private dependency
List of Version of com.siftscience>sift-android-private dependency
Virtual Private Servers
Virtual Private Servers A Virtual Private Server or VPS for short is also know as Virtual Dedicated Server (VDS). Virtual Private Servers is many servers... of a dedicated server to many customers as low cost. In case of Virtual Private Server
Maven Dependency sift-android-private >> 0.0.1
You should include the dependency code given in this page to add Maven Dependency of com.siftscience >> sift-android-private version0.0.1 in your project
Maven Dependency sift-android-private >> 0.0.2
You should include the dependency code given in this page to add Maven Dependency of com.siftscience >> sift-android-private version0.0.2 in your project
Maven Dependency sift-android-private >> 0.0.3
You should include the dependency code given in this page to add Maven Dependency of com.siftscience >> sift-android-private version0.0.3 in your project
Maven Dependency sift-android-private >> 0.0.4
You should include the dependency code given in this page to add Maven Dependency of com.siftscience >> sift-android-private version0.0.4 in your project
What's the proper way to test a class with private methods using JUnit?
What's the proper way to test a class with private methods using JUnit?  What's the proper way to test a class with private methods using JUnit
Access Modifier
Access Modifier       Functionality The AccessModifer Plug-in for Eclipse allows the user to change the visibility (public, protected, default, private) and other
profile doesn't match any valid certificate private key pair in the default keychain
profile doesn't match any valid certificate private key pair in the default keychain   Hi, I am not able to create my application build. Following error is coming profile doesn't match any valid certificate private key pair
Learn to Set Up An Internal Private Repository For An Organization
Learn to Set Up An Internal Private Repository For An Organization       We...;private-internal-repository</key> <description>Private

Ads

 
Advertisement null

Ads