Java MCQ: Which one of the following is not an access modifier?
a) protected
b) void
c) private
d) public
Answer:
b) void
Explanation:
void
is not an access modifier; it is a return type used for methods that do not return any value. The access modifiers in Java are public
, protected
, private
, and the default (package-private) access level.
Reference links:
https://www.rameshfadatare.com/learn-java-programming/
https://www.javaguides.net/p/java-tutorial-learn-java-programming.html