Important Java Mcq 1

You 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 a method.

c. Dive must be the name of an instance field.

d. Submarine must be a method.

Answer:

b. Dive must be a method.

Explanation

Generally, the syntax is Class.methodname(parameters). Here b options says dive is a method which matches the syntax!

Related MCQs
Aniket Malik

Aniket Malik

CERTIFIED TUTOR/TRAINER WITH 300+ REVIEWS

Facing difficulty with

this concept?