This week's book giveaway is in the Android forum.
We're giving away four copies of Learning Java by Building Android Games and have Jean-Marcel Belmont on-line!
See this thread for details.
Win a copy of Learning Java by Building Android Games this week in the Android forum!
    Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

Abstract class  RSS feed

 
Greenhorn
Posts: 7
  • 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??
 
Marshal
Posts: 60748
189
  • 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.
 
Ranch Hand
Posts: 693
Eclipse IDE Firefox Browser Mac OS X
  • 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
Marshal
Posts: 60748
189
  • Mark post as helpful
  • send pies
  • Report post to moderator
. . . and please don't ask the same question twice.
 
It is sorta covered in the JavaRanch Style Guide.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!