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 Abstract class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic

Abstract class

gurpreetsingh hora

Joined: May 27, 2007
Posts: 7
Hi, can someone suggest me why a non-abstract class caanot be extended by abstract class?

is thsi possinle??

class A

class B extends A
if yes why??
if no why??
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 40490
Welcome to the Ranch.

But a concrete class (better term than non-abstract) can be extended by an abstract class.
Kaydell Leavitt
Ranch Hand

Joined: Nov 18, 2006
Posts: 689

Welcome to the JavaRanch gurpreetsingh ,

I tried compiling your example and it compiles. Both A & B are concrete because neither of them is marked with the "abstract" keyword, and neither A nor B needs to be marked as "abstract" because neither of them has any methods that are marked as "abstract".

Please give me more details.

[ May 28, 2007: Message edited by: Kaydell Leavitt ]
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 40490
. . . and please don't ask the same question twice.
jQuery in Action, 2nd edition
subject: Abstract class