Complete the code to declare a protected variable named data.
protected [1] data;The protected keyword is an access modifier. Here, int is the correct data type to declare the variable data.
Complete the code to declare a protected method named showData that returns nothing.
protected [1] showData() { }int or String when the method returns nothing.The method showData does not return any value, so its return type should be void.
Fix the error in the code by completing the access modifier for the method display so it can be accessed by subclasses.
[1] void display() { System.out.println("Hello"); }
The protected modifier allows access to subclasses and classes in the same package.
Fill both blanks to declare a protected constructor for class Example.
class Example { [1] [2]() { } }
A constructor has the same name as the class and can have the protected access modifier.
Fill all three blanks to create a protected method named calculate that returns an integer and takes an integer parameter named value.
protected [1] calculate([2] [3]) { return value * 2; }
The method returns an int, takes an int parameter named value, and is declared protected.
