CAN WE CALL STATIC METHOD WITH NULL OBJECT?

Mayank Tripathi

Total Post:807

Points:4035
Posted by  Mayank Tripathi
Java 
 872  View(s)
Ratings:
Rate this:
  1. Mayank Tripathi

    Post:807

    Points:4035
    Can we call static method with null object?

    Yes we can call because static method is bound at compile time and only type of variable is used for static binding not the value of object. It’s not a good practice to call static method by instance, always call static method in Java by using class name like Math.max()

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!