The code given below checks the concepts of packages in java and prepares for the SCJP examination.
The code given below checks the concepts of packages in java and prepares for the SCJP examination.Which modifier should used in place of **** , so that it's subclass saved in other package can access " FixVariable() " method of it's super class ?
package NewPackage;
public class Example extends rose{
private int length;
*** void FixVariable( int a ) {
length = a;
}
}
// subclass in different package
import NewPackage.Example ;
public class SubExample extends Example {
SubExample() {
FixVariable( 201 );
}
Which modifier should used in place of ****, so that it's subclass 'SubExample' saved in other package can access 'FixVariable()' method of it's super class ?
1.private
2.public
3.protected
4.default(blank)
2 & 3