+ 3

Can we call static methods in java with object of that class??

give example code for this

16th Oct 2017, 1:57 PM
Biplab Ghosh
Biplab Ghosh - avatar
6 Answers
+ 4
Yes we can. Just like a normal method call as if it wasn't static. No real point in doing that though.
16th Oct 2017, 3:53 PM
Rrestoring faith
Rrestoring faith - avatar
16th Oct 2017, 2:40 PM
Biplab Ghosh
Biplab Ghosh - avatar
+ 2
Yes, it is valid, but it's a bad practice. Even the compiler will warn you about that.
16th Oct 2017, 10:45 PM
Daniel de Lizaur
0
Yes we can. But, we should avoid it, so that it does not arise any confusion later. It is a mistake made by java at the early stage of it's release. But, later they kept it as it is, so that any existing code written that way does not break.
16th Oct 2017, 7:37 PM
Debapriya Sen
Debapriya Sen - avatar