Bird
0
0

Which return type should a method have if it returns no value?

easy📝 Conceptual Q2 of 15
Java - Methods and Code Reusability
Which return type should a method have if it returns no value?
Anull
Bint
CString
Dvoid
Step-by-Step Solution
Solution:
  1. Step 1: Recall method return types

    Methods that do not return any value must use the void return type.
  2. Step 2: Understand other types

    Types like int or String expect a value to be returned, null is not a valid return type.
  3. Final Answer:

    void -> Option D
  4. Quick Check:

    Method with no return value = void [OK]
Quick Trick: Use void when no value is returned [OK]
Common Mistakes:
  • Using int or String when no value is returned
  • Returning null instead of void
  • Omitting return type

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Java Quizzes