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 Concrete 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
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: 38107
    
  22
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: 38107
    
  22
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: 38107
    
  22
W. Joe Smith wrote:Ah, that makes sense.
That's unusual for one of my posts
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Concrete class
 
Similar Threads
concrete class
Why java.lang.Object class is concrete class? Why not it is a abstract class?
Why do we have concrete methods in abstract class ?
List Best Inventions
Abstract class