How can you declare 'i' so that it is not visible outside the package test.
package test; public class Test{ XXX int i; /* irrelevant code */ } Select 2 options
Correct Options are : A D
A. is correct.
Note that the question does not require that 'x' should be accessible from test package.
So private is fine.
B. is wrong.
Marking it public will make it accessible from all classes in all packages.
C. is wrong.
It will make it available to a subclass even if the subclass is in a different package.
E. is wrong.
There is no such modifier in Java.