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{ |
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.
Ask Questions? Discuss: Public Java Keyword
Post your Comment