Skip to content
Sharp

Object-oriented programming · interview question

How would you explain a method in a Java class in an interview?

Multiple choiceMediumchapter-2-curatedpremiumoopbasic-modeling
Choose one answer
Answer and explanation

Correct answer

C. A function defined within a class.

Why

A method in a Java class is a function defined within that class to perform specific actions. It can operate on the data contained in the object and can be called to perform computations or operations.

Test yourself on Object-oriented programming

A free test with instant, explained results. No account needed.

Start free test
All Object-oriented programming questions →