Bird
0
0

What does the return keyword do in a Java method?

easy📝 Conceptual Q11 of 15
Java - Methods and Code Reusability
What does the return keyword do in a Java method?
AIt stops the program completely.
BIt sends a value back from the method to where it was called.
CIt prints a value to the screen.
DIt declares a new variable inside the method.
Step-by-Step Solution
Solution:
  1. Step 1: Understand the purpose of return

    The return keyword is used inside a method to send a value back to the caller.
  2. Step 2: Differentiate from other actions

    Stopping the program, printing, or declaring variables are different actions and not what return does.
  3. Final Answer:

    It sends a value back from the method to where it was called. -> Option B
  4. Quick Check:

    Return sends value back [OK]
Quick Trick: Return sends data back from method to caller [OK]
Common Mistakes:
  • Thinking return stops the whole program
  • Confusing return with print statements
  • Assuming return declares variables

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Java Quizzes