4.17 |
Given the following definition of a class, which fields are accessible from outside the package com.corporation.project?
package com.corporation.project;
public class MyClass {
int i;
public int j;
protected int k;
private int l;
}
Select the two correct answers.
Field i is accessible in all classes in other packages. Field j is accessible in all classes in other packages. Field k is accessible in all classes in other packages. Field k is accessible in subclasses only in other packages. Field l is accessible in all classes in other packages. Field l is accessible in subclasses only in other packages.
|
4.18 |
How restrictive is the default accessibility compared to public, protected, and private accessibility?
Select the one correct answer.
Less restrictive than public. More restrictive than public, but less restrictive than protected. More restrictive than protected, but less restrictive than private. More restrictive than private. Less restrictive than protected from within a package, and more restrictive than protected from outside a package.
|