This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Quetions abt Overriding a Method in a Concrete Class 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 » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Quetions abt Overriding a Method in a Concrete Class" Watch "Quetions abt Overriding a Method in a Concrete Class" New topic
Author

Quetions abt Overriding a Method in a Concrete Class

Harry D'Souza
Greenhorn

Joined: Dec 28, 2002
Posts: 28
Hi,
I have a question. I know it is simple but somehow it just does not strike to me. I guess I am too stressed out
I have an abstract class that has two methods - one declared abstract [i.e Method1()] and the other that is defined [Method2()]. In my Concrete Class, I have defined Method1() and want to override Method2().I wish to override Method2() as I would like to extend the functionality of this method which was already defined.
My question is: While overriding the Method2() how do I call the Method2() of the Abstract Class?

The code for the above scenario Could be like this :
The code for the Abstract Class : AbstractClass.java

The code for the Concrete Class : ConcClass.java

[ April 26, 2003: Message edited by: Harry D'Souza ]

Harry D'Souza<br />SJCP 1.4 , SCWCD
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
super.Method2(); should do the trick.


SCJP 1.4, SCWCD 1.3, SCBCD 1.3
Harry D'Souza
Greenhorn

Joined: Dec 28, 2002
Posts: 28
Roger,
It sure does. I feel so bad that it did not strike me. As I said I knew it was easy but ..
Thanks for your reply.
 
 
subject: Quetions abt Overriding a Method in a Concrete Class
 
Similar Threads
Abstract method concept,How it can be ? help me please.
Another method invocation question...
abstract class method suggestion
class defined inside an interface
interface and concrete classes