Difference between default and protected access specifiers?



Difference between default and protected access specifiers?..

Answer / Sunder Lal

By default, all variables and methods in Java have package-private (default) access. Protected access allows subclasses from a different package to access the variable or method. In contrast, default access only allows access within the same package.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

Explain java coding standards for interfaces?

1 Answers  


Java support call by reference (pass by reference) ?

1 Answers   HCL,


What is the return type of a program?s main() method?

3 Answers  


how to handle exceptions in ejb?

1 Answers   HCL,


program to validate the IP address? Validity range should be 0 to 255

1 Answers   Huawei,


What is the use of jtable?

1 Answers  


What is a method header?

1 Answers  


What occurs when an object is constructed?

1 Answers  


Explain wait(), notify() and notifyall() methods of object class ?

1 Answers  


Can we catch more than one exception in a single catch block?

1 Answers  


int a=1,b=10; System.out.println(a+b--);

12 Answers   HCL,


What is e java?

1 Answers  


Categories