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 Programmer Certification (SCJP/OCPJP) and the fly likes abstract 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 » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "abstract" Watch "abstract" New topic
Author

abstract

b reddy
Greenhorn

Joined: Apr 30, 2007
Posts: 7
how do we access a concrete method of an abstract class from a concrete class?
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
Could you be more specific?

What relationship does the concrete class have to the abstract class?
b reddy
Greenhorn

Joined: Apr 30, 2007
Posts: 7
suppose if there is an abstract class x. show() is a concrete method in x class.
y is a class which extends x.
how do we access show() of class x?
can we override methods that are in abstract classes?
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
Yes you can override methods that are inherited from abstract classes as long as you obey the usual rules of overriding.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60800
    
  65

"breddy",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
JavaRanch Sheriff


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
b reddy
Greenhorn

Joined: Apr 30, 2007
Posts: 7
can we create an object to an abstract class?
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
No, you can't create an instance of an abstract class with a constructor.
Meena R. Krishnan
Ranch Hand

Joined: Aug 13, 2006
Posts: 178
Here is an eg. showing how to access / override / overload a concrete method that is declared in the abstract base class.

b reddy
Greenhorn

Joined: Apr 30, 2007
Posts: 7
Hi Keith,
can you tell me the difference between instance variable and an reference variable?
b reddy
Greenhorn

Joined: Apr 30, 2007
Posts: 7
Hi krishnan,

are you sure that a.supershow() will work?
i dont think so this will work.
Meena R. Krishnan
Ranch Hand

Joined: Aug 13, 2006
Posts: 178

are you sure that a.supershow() will work?
i dont think so this will work.



why do you think so?

superShow() is a method in the extended class which in turn calls the super class' concrete method.

Here is the o/p from the above code.
 
Don't get me started about those stupid light bulbs.
 
subject: abstract
 
Similar Threads
concrete class
Doubt on Abstract classes
abstarct class
Simple Question regarding Abstract class
abstract subclass