This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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: 38033
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: 688

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: 38033
. . . and please don't ask the same question twice.
I agree. Here's the link:
subject: Abstract class
Similar Threads
interface is nothing but a pure abstract class. why interface does not has constructor
HttpServlet class
Why a class declared as Abstract, cannot have any abstract method declaration?
about Class AbstractCollection
why java's Object class not abstract ?