What are the different acess specifiers?

Showing Answers 1 - 12 of 12 Answers

radhika

  • Feb 25th, 2006
 

the different access specifiers are

public:

private:

protected:

friendly :

  Was this answer useful?  Yes

PavanKumar B

  • Mar 3rd, 2006
 

Java has four different access specifiers: public, private, package, and protected.

private : The most restrictive of the access specifiers is private. If a variable [or a method] is declared private, then it can only be accessed by methods in that class.

public : The least restrictive of the access specifiers is public. If a method has public in front of it, then any object of that class can be told to perform that action.

package : Every class that is in the same package has access to the fields and methods in your class.

protected : If you have a variable or method in your class that you don't want clients of your class directly accessing, declare it protected.

I Think Classes in the same package are said to be friendly..It is not Acess Specifier

  Was this answer useful?  Yes

dev

  • Mar 7th, 2006
 

Hi Radika,

 Frindly is not there in java,

Access Specifiers are public,private,protected, and default

  Was this answer useful?  Yes

Hi All,

Access specifiers include:

public, private, protected (explicit specification).

If there is a class with no explicit specification with above modifiers the class is said to be having a default access.

Hence no friendly or default keywords are used for access modifier. However, default keyword is used in switch.. case construct.

  Was this answer useful?  Yes

Guest

  • Mar 9th, 2006
 

Hi All,

Access specifiers include:

public, private, protected (explicit specification).

If there is a class with no explicit specification with above modifiers the class is said to be having a default access.

Hence no friendly or default keywords are used for access modifier. However, default keyword is used in switch.. case construct.

  Was this answer useful?  Yes

srinivas.bora

  • Mar 21st, 2006
 

hi friends,

public: Any thing declared as public can be accessed from anywhere. private: Any thing declared as private can?t be seen outside of its class. protected: Any thing declared as protected can be accessed by classes in the same package and subclasses in the other packages. default modifier : Can be accessed only to classes in the same package.okey baye....... 

if there is any Questionon j2se and j2ee plz send to my mail id

bora_srinivasarao@yahoo.co.in

keeps smiling and mailing

bora_srinivasarao@yahoo.co.in

  Was this answer useful?  Yes

chandra

  • Apr 6th, 2006
 

  

 

       hello all    i am chandra

     friendly is not access specifiers in java  above all are access specifiers but default is also accessfiers .

 

 

 

bye chandra

  Was this answer useful?  Yes

sudha

  • Oct 17th, 2006
 

what is the technical architecture?

what is the project architecture?

  Was this answer useful?  Yes

snehlata

  • Sep 15th, 2007
 

there are 4 access specifiers defined in java.
private: who can be accessed within class only.
default:who can be accessed within the same package.
protected: who can be accessed within the same package and by subclass of other package.
public: who can be accessed everywhere i.e. within the same package and any other package.

  Was this answer useful?  Yes

Neharika Sanwasi

  • Dec 28th, 2012
 

public:
default:
private:
protected:

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions