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
posted
0
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
posted
0
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
posted
0
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?