This will always throw a NullPointerExcpetion unless someMethod is declared static. However, calling static methods on an instance is very bad practice.
yes you can call if the method is static because static method is bound at compile time and only type of variable is used for static binding not the value of object.
if you try the same for non static method,get ready to catch a null pointer exception.
This will always throw a
NullPointerExcpetion
unless someMethod is declared static. However, calling static methods on an instance is very bad practice.No we can't. it will throw NullPointerException as long as the method is not static. If method is static it will run.
Read this: null : Java Glossary
yes you can call if the method is static because static method is bound at compile time and only type of variable is used for static binding not the value of object.
if you try the same for non static method,get ready to catch a null pointer exception.
No. In Java, null is not an object.