Bookmark Topic Watch Topic
  • New Topic

Abstract class

 
gurpreetsingh hora
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Pie
Posts: 47293
52
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
Welcome to the Ranch.

But a concrete class (better term than non-abstract) can be extended by an abstract class.
 
Kaydell Leavitt
Ranch Hand
Posts: 689
Eclipse IDE Firefox Browser Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Pie
Posts: 47293
52
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
. . . and please don't ask the same question twice.
 
I agree. Here's the link: http://aspose.com/file-tools
    Bookmark Topic Watch Topic
  • New Topic