wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes calling abstract methods from non-abstract methods.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "calling abstract methods from non-abstract methods.." Watch "calling abstract methods from non-abstract methods.." New topic
Author

calling abstract methods from non-abstract methods..

aadhi agathi
Ranch Hand

Joined: Apr 29, 2002
Posts: 263
Why does it not complain about defining f1() as abstract....

yes, it helps to control the flow but any other "semantical" reasons for this .


Aadhi
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1121

Hi Aadhi,
Why does it not complain

I assume "it" refers to the compiler. In other words, you want to know why the code (you have posted) compiles, right? Compilers usually only check syntax and dependencies. As long as you have some subclass (of "AbstractClass") that implements method "f2()", you should be fine.
So are you saying that your code compiles even without such a subclass?
Cheers,
Avi.
aadhi agathi
Ranch Hand

Joined: Apr 29, 2002
Posts: 263
Originally posted by Avi Abrami:

I assume "it" refers to the compiler.
In other words, you want to know why the code (you have posted) compiles, right?

yes!

Compilers usually only check syntax and dependencies. As long as you have some subclass (of "AbstractClass") that implements method "f2()", you should be fine.

To reformat, I can't do this(topic), in a concrete class. But is there any hidden meaning to allow this in an abstract class(i could guess only flow control).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: calling abstract methods from non-abstract methods..
 
Similar Threads
Compilation error
HashCode mock question
public strictfp abstract class A{}
combination of access & non-access modifiers for a class
Why is this code printing false false...this is from K&B book