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 Beginning Java and the fly likes Extending a 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 » Java » Beginning Java
Bookmark "Extending a class " Watch "Extending a class " New topic

Extending a class

jose chiramal
Ranch Hand

Joined: Feb 12, 2010
Posts: 266
How many ways can we extend a class ?

Can i say that we can extend a class in two ways :
1. using extends
2. using anonymous inner class
Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3013

You can extend an exception class as the same way as you extend any other class.
An anonymous inner class implicitly extends another class - so it can be used.

Founder of ExamLab and Systemup
See how I can help you to become an awesome programmer
Lalit Mehra
Ranch Hand

Joined: Jun 08, 2010
Posts: 384

@ jose

yes ofcourse you can extend a class using extends ...

anonymous innner classes serve as an implicit datatype for the class they are constructed in ... having access to all its (data/method) members.
I agree. Here's the link:
subject: Extending a class
Similar Threads
Inner class
Question from K&B Chapter 5
Aggregation And Inheritence
Doubt in TagSupport (Classic Tag)