Skip to content

Read the following statement in a Java program that compiles and executes- submarine.dive(depth); What can you say for sure?

  1. A.depth must be an int
  2. B.dive must be the name of an instance field
  3. C.dive must be a method
  4. D.submarine must be the name of a class
Show answer

Answer: C. dive must be a method

The syntax dive(...) denotes invoking a method named dive.