Home > Technical Interviews > Computer Science & Engineering > Java Programming > Core Questions and Answers
96. | If a method is declared as protected, where may the method be accessed? |
A protected method may only be accessed by classes or interfaces of the same package or by subclasses of the class in which it is declared. |
97. | What restrictions are placed on the values of each case of a switch statement? |
During compilation, the values of each case of a switch statement must evaluate to a value that can be promoted to an int value. |
98. | If a method is declared as protected, where may the method be accessed? |
A protected method may only be accessed by classes or interfaces of the same package or by subclasses of the class in which it is declared. |
99. | What is the difference between a public and a non-public class? |
A public class may be accessed outside of its package. A non-public class may not be accessed outside of its package. |
100. | To what value is a variable of the boolean type automatically initialized? |
The default value of the boolean type is false |