Bird
0
0

What is true about a non-static method in Java?

easy📝 Conceptual Q2 of 15
Java - Static Keyword
What is true about a non-static method in Java?
AIt can be called without creating an object.
BIt can access static variables directly.
CIt belongs to the class, not instances.
DIt cannot access instance variables.
Step-by-Step Solution
Solution:
  1. Step 1: Understand non-static method properties

    Non-static methods belong to object instances and can access both instance and static variables.
  2. Step 2: Evaluate options

    Non-static methods can access static variables directly, but cannot be called without an object.
  3. Final Answer:

    It can access static variables directly. -> Option B
  4. Quick Check:

    Non-static method access = static variables allowed [OK]
Quick Trick: Non-static methods need objects but can access static variables [OK]
Common Mistakes:
  • Calling non-static methods without an object
  • Thinking non-static methods can't access static variables

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Java Quizzes