Read the following statement in a Java program that compiles and executes- submarine.dive(depth); What can you say for sure?
- A.depth must be an int
- B.dive must be the name of an instance field
- C.dive must be a method
- 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.