Multiple choice

Which of the following statements is/are correct for static method in Java?

A. Static methods are always public. B. Static method cannot access directly non-static method of the same class.

  1. Only A

  2. Only B

  3. Both A and B

  4. Neither A nor B

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

It is not necessary that the static methods are always public. But it is true that static methods cannot access directly non-static method of the same class.