top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Java: Can we call static method with null object?

+1 vote
Java: Can we call static method with null object?
posted Sep 4, 2013 by Arvind Singh

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+2 votes

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 Sep 4, 2013 by Vinay Shukla
Similar Questions
+2 votes

I am working on an app with Java and Struts2.
I fetch all data from my DB to an Object(eg.XXX) List at once while Tomcat(7) is coming up. Then according to user selection, I am trying to get data from the same List by doing Ajax call. But it is failing and getting an empty list. I don't want to use session.
Can I use and global object list for this?? An Example will be more helpful.