Can we decleare a static method or a static class as abstract? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can we decleare a static method or a static class as abstract?

Is it possible in java to declare a static method() and a static class as abstract?

12th Feb 2018, 9:10 AM
RAJESH SINHA
RAJESH SINHA - avatar
1 Answer
+ 1
No, because static methods are perfect class members. They are not involved in inheritance & are loaded into the memory when the class loads in the memory for the 1st time along with the static main(String... args) method. While an abstract method has to be inherited by a concrete class so that it can be accessed. Same goes for static inner class.
6th Mar 2018, 1:15 PM
Plus
Plus - avatar