Bird
0
0

Which of the following is the correct way to call an instance method display() of an object obj?

easy📝 Syntax Q12 of 15
Java - Classes and Objects
Which of the following is the correct way to call an instance method display() of an object obj?
Adisplay();
Bstatic display();
CClassName.display();
Dobj.display();
Step-by-Step Solution
Solution:
  1. Step 1: Recall instance method call syntax

    Instance methods are called using the object name followed by dot and method name, like obj.display();.
  2. Step 2: Check other options

    Calling without object or using class name is for static methods; static display(); is invalid syntax.
  3. Final Answer:

    obj.display(); -> Option D
  4. Quick Check:

    Call instance method with object name [OK]
Quick Trick: Use objectName.methodName() to call instance methods [OK]
Common Mistakes:
  • Calling instance method without object
  • Using class name for instance method call
  • Trying to call instance method as static

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Java Quizzes