Can we call static method with null object?

By | August 9, 2019

In this post we will discuss about one of very tricky core java interview question and question is that Can we call static method with null object ?

This is the trickiest Java interview question I ever encountered. we can call static method with null object or reference because static method is bound at compile time and only type of variable is used for static binding not the value of object. It is not a good practice to call static method by instance, we should always call static method in Java by using class name like Welocme.dispaly(); 

Output of above program:

You may also like:

Java program to add two matrices
Matrix Subtraction Java program
Java program to find maximum element in each row of the matrix
Java program to find maximum and minimum numbers in the given matrix

That’s all about  Can we call static method with null object ?
If you have any feedback or suggestion please feel free to drop in blow comment box.

Leave a Reply

Your email address will not be published. Required fields are marked *