wood burning stoves 2.0*
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 Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

Abstract class

gurpreetsingh hora
Greenhorn

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
Sheriff

Joined: Oct 13, 2005
Posts: 36590
    
  16
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.

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

Joined: Oct 13, 2005
Posts: 36590
    
  16
. . . and please don't ask the same question twice.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Abstract class
 
Similar Threads
about Class AbstractCollection
Why a class declared as Abstract, cannot have any abstract method declaration?
why java's Object class not abstract ?
HttpServlet class
interface is nothing but a pure abstract class. why interface does not has constructor