QuestionQ37

Working with Methods and Encapsulation

Given:

Question Image

What is the resulting output?

  • A Jump1 -Jump1 -Jump1
  • B Jump2 -Jump2 -Jump3
  • C Jump3 -Jump3 -Jump3
  • D Jump1 -Jump1 -Jump3
Explanation

Java integer literals such as 10 and 100 have type int, so they invoke jump(int), which prints Jump2. The f suffix makes 10.01f a float, so it invokes jump(float), which prints Jump3.

Community Discussion

No comments yet. Be the first to start the discussion!