Computer Applications
Read the following text and choose the correct answer:
Public access specifier allows a class to expose its member variables and member functions to other functions and objects. Any public member can be accessed from outside the class.
Which of these access specifier must be used for class so that it can be inherited by another subclass?
- public
- private
- protected
- none of the mentioned
Encapsulation & Inheritance in Java
1 Like
Answer
public
Reason — According to the given context, public access specifier can be used for class so that it can be inherited by another subclass.
Answered By
3 Likes
Related Questions
The method to determine whether the specified char value is in uppercase or not.
- toUpperCase(char)
- toLowerCase(char)
- isLowerCase(char)
- isUpperCase(char)
Assertion (A) Method should be called explicitly either with object reference or class reference.
Reason (R) Method can be any user defined name.- Both Assertion (A) and Reason (R) are true and Reason (R) is a correct explanation of Assertion (A).
- Both Assertion (A) and Reason (R) are true and Reason (R) is not a correct explanation of Assertion (A).
- Assertion (A) is true and Reason (R) is false.
- Assertion (A) is false and Reason (R) is true.
Assertion (A) The return statement causes program control to transfer back to the caller of the method.
Reason (R) The return statement immediately terminates the method in which it is executed.- Both Assertion (A) and Reason (R) are true and Reason (R) is a correct explanation of Assertion (A).
- Both Assertion (A) and Reason (R) are true and Reason (R) is not a correct explanation of Assertion (A).
- Assertion (A) is true and Reason (R) is false.
- Assertion (A) is false and Reason (R) is true
Correct statement to declare an integer array of 10 elements.
- int[ ] arr = new int[10];
- int arr;
- int arr (10);
- int ( ) arr = new int (10);