What are different types of access modifiers?

Answers were Sorted based on User's Feedback



What are different types of access modifiers?..

Answer / venki

Private : It can access with in the class only
public :It can Access Any where
proteced:It can access with in the package and sub class of
the package also
default:it access with in the package only.

Is This Answer Correct ?    13 Yes 3 No

What are different types of access modifiers?..

Answer / shekhar suchak

private:it can be access within the block or we can aslo say that within the class.

public:"every where,any where" just one line ans.

protected:it can be access within package and outside of package.but there should be inheritense.

default:it will be access within the package.

class can not be private and protected.its only default and public.we dont have to mention 'default' keywords it always be there,but invisible.

Thanks & Regards

Is This Answer Correct ?    0 Yes 0 No

What are different types of access modifiers?..

Answer / nani

Private : It can access with in the class only
public :It can Access Any where in java program
proteced:It can access with in the package and sub class of
the package also
default:it access with in the java program.

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More Core Java Interview Questions

Is binary a low level language?

0 Answers  


Why there are some null interface in java? What does it mean?

0 Answers  


How do generics work in java?

0 Answers  


why ,we are using jsp and html.which one is better?

2 Answers   Photon,


What is function and method in java?

0 Answers  


How can a gui component handle its own events?

0 Answers  


What is java abstraction with example?

0 Answers  


Discuss 2D arrays.

0 Answers   Amdocs,


java is pure object-oriented programming language?why it is platform independent.

1 Answers  


how to fing linkedlist is circular or not?

1 Answers   TCS,


Is it compulsory for a try block to be followed by a catch block in java for exception handling?

0 Answers  


What is a map in java?

0 Answers  


Categories