Complete the code to declare a class with default access modifier.
class [1] { void display() { System.out.println("Hello"); } }
The class name should be provided without any access modifier to use the default access modifier.
Complete the code to declare a method with default access modifier inside a class.
class Test { [1] void show() { System.out.println("Show method"); } }
To use the default access modifier for a method, no access keyword is used before the return type.
Fix the error in the code by choosing the correct access modifier for the class to have default access.
[1] class Sample { void test() { System.out.println("Test method"); } }
Default access modifier means no keyword before the class name.
Fill both blanks to declare a variable and a method with default access modifier inside a class.
class Example { [1] int number; [2] void display() { System.out.println(number); } }
Both the variable and method use default access modifier by having no access keyword.
Fill all three blanks to declare a class, a variable, and a method with default access modifier.
[1] class Data { [2] int value; [3] void print() { System.out.println(value); } }
Default access modifier means no keyword before class, variable, or method.
