It's not a secret anymore!*
The moose likes Beginning Java and the fly likes abstract method call Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "abstract method call" Watch "abstract method call" New topic
Author

abstract method call

Gyutae Kim
Greenhorn

Joined: Aug 07, 2002
Posts: 2
i have a piece of code that looks like this
abstract public class super
{
public void meth(){absMeth();}
abstract void absMeth();
}
public class sub extends super
{
protected void absMeth(){print something}
}
then when i run the meth method of sub nothing gets printed out shouldnt this work?
[ August 07, 2002: Message edited by: Gyutae Kim ]
[ August 07, 2002: Message edited by: Gyutae Kim ]
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Gyutae,
Try this:

Hope this helps,
Michael Morris


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Dan Chisholm
Ranch Hand

Joined: Jul 02, 2002
Posts: 1865
Gyutae,
You have attempted to use the keyword "super" as a class identifier. You need to change the name of your class.
If you want to put both class declarations in the same file, then you need to make sure that only one is declared public.


Dan Chisholm<br />SCJP 1.4<br /> <br /><a href="http://www.danchisholm.net/" target="_blank" rel="nofollow">Try my mock exam.</a>
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
then when i run the meth method of sub nothing gets printed out shouldnt this work?
Yes, Gyutae, such a structure should work. You perhaps have an error in your code. What is the code that you're trying to compile and run?


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: abstract method call
 
Similar Threads
it should be more ambiguous then previous version.
doubt var arg
overriding of static methods
Method Overriding. Please help
abstrct inner classes