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

What is meant by JVM ?

6 Answers  


What happens if main method is not static?

0 Answers  


why the constructor should be used in class,if there is no constructor what will happen?

4 Answers  


what are the oops concept in java explain with real time examples

24 Answers   Accenture, Bosch, Consummate Technologies, CTS, Current Technologies, iNautix, Infosys, Kekran Mekran, QA InfoTech, RTRT, SofTech, Tech Mahindra, Thorogood, Timios, Wipro,


Why we used break and continue statement in java?

0 Answers  






State the merge-sort principle and its time complexity.

0 Answers   Akamai Technologies,


WHAT IS THE SCOPE FOR COREJAVA...? IS JAVA ONLY CORE JAVA ?

2 Answers  


as we know a static method could access static data and static method only. then how could main method call the object of aclass which is not static and other non static data

1 Answers  


why doesn't java run on all platforms?

0 Answers  


Is null function in java?

0 Answers  


what is use of functional interface in java 8?

0 Answers  


Can we convert list to set in java?

0 Answers  


Categories