+ 16

Might some correction is possible in a java quiz

👉what is valid about static method ? answer ::: u can use it by calling its class i think it must be ::: u can call it by using the class name where its definition is given //every1 makes it correct bcz just after seeing static ... they search for class somewhere & that will be the only answer //what U think ???

23rd Dec 2017, 6:32 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
4 ответов
+ 14
statics methods also gets inherited ... so when we call method from subclass that is present in super class ... we call it by <name of superclass>. method ()
23rd Dec 2017, 10:03 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 1
"using the class name where its definition is given" is more restrictive, wouldn't that mean that you couldn't call a static method of a superclass from a subclass?
23rd Dec 2017, 9:10 PM
Dan Walker
Dan Walker - avatar
+ 1
what I'm saying is that you can call <name of subclass>.method() which doesn't quite align with the proposed amendment, so more careful wording is needed
23rd Dec 2017, 10:35 PM
Dan Walker
Dan Walker - avatar
0
2nd one
23rd Dec 2017, 6:36 PM
Mr.Curious
Mr.Curious - avatar