my dog learned polymorphism*
The moose likes Beginning Java and the fly likes Concrete class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Concrete class" Watch "Concrete class" New topic
Author

Concrete class

jacob deiter
Ranch Hand

Joined: Apr 02, 2008
Posts: 576
If a class is Concrete class then it should extend a class??

For Example

Class A
{
}

Class B
{
A a=new A();
}

can I say Class A and B a Concrete class???
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

No, it just shouldn't be an abstract class.

Every class you write is going to extend some other class. Often it will extend Object, but that's still extending a class.
John de Michele
Rancher

Joined: Mar 09, 2009
Posts: 600
Jacob:

Not necessarily (other than the obligatory extension of Object). Any class that's not abstract is concrete. Usually, though, the term means that either the class is extending an abstract class, or is implementing an interface.

John.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38517
    
  23
I would stick to Paul's definition: not abstract. You might say "concrete" to distinguish it from "abstract" but neither extending nor implementing makes a class any more "concrete."
W. Joe Smith
Ranch Hand

Joined: Feb 10, 2009
Posts: 710
Campbell Ritchie wrote:I would stick to Paul's definition: not abstract. You might say "concrete" to distinguish it from "abstract" but neither extending nor implementing makes a class any more "concrete."


Would that be the same as saying you can make an instance of the class? I thought the primary difference between abstract and "concrete" classes was that "concrete" classes could be instantiated whereas abstract classes could not.


SCJA
When I die, I want people to look at me and say "Yeah, he might have been crazy, but that was one zarkin frood that knew where his towel was."
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38517
    
  23
Not quite. You can't instantiate an abstract class, but there are some concrete classes which cannot be instantiated either. Example: java.lang.Math.
Any class you can create an instance of, however, is concrete.
W. Joe Smith
Ranch Hand

Joined: Feb 10, 2009
Posts: 710
Campbell Ritchie wrote:Not quite. You can't instantiate an abstract class, but there are some concrete classes which cannot be instantiated either. Example: java.lang.Math.
Any class you can create an instance of, however, is concrete.


Ah, that makes sense.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38517
    
  23
W. Joe Smith wrote:Ah, that makes sense.
That's unusual for one of my posts
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Concrete class