File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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

Joined: Jul 29, 2008
Posts: 3912

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.

Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
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
It's not a secret anymore!