Home Help Java P Protected Java Keyword



Protected Java Keyword
Posted on: June 9, 2009 at 12:00 AM
protected is a keyword defined in the java programming language

Protected Java Keyword

     

protected is a keyword defined in the java programming language. Keywords are basically reserved words which have specific meaning relevant to a compiler in java programming language likewise the protected keyword indicates the following :  

--  It  is used as an access control modifier.
--  It is applicable to a class, a method or a field.  
--   protected method or a variable is only visible to the classes within the same package.
--   A protected  class, method or field are only referenced from within the class in which it is declared. 

Using a protected Keyword within a classprotected Keyword within a class

Examples

public class ClassName

{

protected class ClassName1;

 

}

Declaring Protected Variable

public class ClassName

{

protected int i;

}

Declaring Protected Method

public class ClassName

{

protected int i;

protected String Method()

{

<statements>
<statements>

...

<statements>

}
}

Related Tags for Protected Java Keyword:
javaccomcompilerantwordcompilekeykeywordspilbasicifcallkeywordmpitoicalciwordseilpeincalasmntcajesspecallpimemeanrelwhichsspkhalleaarspecificreservedrdsrvvassrdavevaevaicaicaomo


More Tutorials from this section

Ask Questions?    Discuss: Protected Java Keyword  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.