Which of the following is not a return type?
-
A. boolean
-
B. void
-
C. public
-
D. Button
Reveal answer
Fill a bubble to check yourself
C
Correct answer
Explanation
public is an access modifier, not a return type. Valid return types include primitive types like boolean, void, or object types like Button. Access modifiers control visibility, not what a method returns.
AI explanation
'boolean', 'void', and 'Button' are all valid method return types (a primitive, no-return-value marker, and an object/class type respectively). 'public', however, is an access modifier that controls visibility (who can call the method) — it is never itself a return type; it appears in a method signature alongside a return type, e.g., public void foo(). So 'public' is correctly identified as not a return type.