Home Help Java P Public Java Keyword



Public Java Keyword
Posted on: November 16, 2009 at 12:00 AM
public is a keyword defined in the java programming language.

Public Java Keyword

     

public 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 public keyword indicates the following :  

--  It  is used as an access control modifier.
--  It is applicable to a class, a method or a field.  
--   public class, method or a variable are visible to all the classes defined in different package.
--   A public class, method or field can be referenced from outside the class in which it is declared. 

Using a public Keyword within a class

public class ClassName{

public class ClassName1;

}

Declaring public Variable

public class ClassName

{

public class ClassName1;

public int i;

}

Declaring public Method

public class ClassName{
public String Method(){
<statements>
<statements>
...

<statements>
}

}

Related Tags for Public Java Keyword:


More Tutorials from this section

Ask Questions?    Discuss: Public 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.