Interview Questions - Core Java
25.
Can a class declared as private be accessed outside it's package?
Not possible.
26.
Can a class be declared as protected?
The protected access modifier cannot be applied to class and interfaces. Methods, fields can be declared protected, however methods and fields in a interface cannot be declared protected.
27.
What is the access scope of a protected method?
A protected method can be accessed by the classes within the same package or by the subclasses of the class in any package.
28.
What is the purpose of declaring a variable as final?
A final variable's value can't be changed. final variables should be initialized before using them.
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers