why, if one method is declared as abstract, the same cannot be declared as static ?
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
i m talking about interface in which methods are implicitly abstract and that method cannot have static modifier ? why so ?
The Only way to learn is ...........do!
Visit my blog http://inaved-momin.blogspot.com/
-
3 -
-
Number of slices to send:Optional 'thank-you' note:
-
-
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Matthew Brown wrote:Marking a method abstract means that you will override it in a sub-class and provide the implementation. A static method cannot be overridden, so it would be impossible to provide the implementation of a static abstract method. So it makes no sense to allow it.
static method cannot be overriden because those methods are for that particular class ?
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
naved momin wrote:static method cannot be overriden because those methods are for that particular class ?
Please, SearchFirst

-
-
Number of slices to send:Optional 'thank-you' note:
-
-
naved momin wrote:
Matthew Brown wrote:Marking a method abstract means that you will override it in a sub-class and provide the implementation. A static method cannot be overridden, so it would be impossible to provide the implementation of a static abstract method. So it makes no sense to allow it.
static method cannot be overriden because those methods are for that particular class ?
Static members are shared among all instances of a class -- one might say, independently of its instances.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
naved momin wrote:
Matthew Brown wrote:Marking a method abstract means that you will override it in a sub-class and provide the implementation. A static method cannot be overridden, so it would be impossible to provide the implementation of a static abstract method. So it makes no sense to allow it.
static method cannot be overriden because those methods are for that particular class ?
They cannot be overridden because the language designers decided to make it that way. In some languages (like SmallTalk, I think), static methods can be overridden. Java's designers had a different model in mind for class, objects, and polymorphism. It was a language design choice. If you want to know why that choice was made, you'd have to ask them, or see if it shows up in a whitepaper somewhere. A good guess, though, would be that it keeps the language simpler. Simplicity has always been one of Java's key goals.
| No prison can hold Chairface Chippendale. And on a totally different topic ... my stuff: Paul Wheaton's 16th Kickstarter: Gardening playing cards for gardeners and homesteaders https://coderanch.com/t/889615/Paul-Wheaton-Kickstarter-Gardening-playing |








