- Forum
- Programming Talk
- Java
- Abstract classes
+ Reply to Thread
Results 1 to 10 of 14
Abstract classes
This is a discussion on Abstract classes within the Java forums, part of the Programming Talk category; Can we call a concrete method of an abstract class, without inheriting the abstract class? If yes, then how?...
Abstract classes
Can we call a concrete method of an abstract class, without inheriting the abstract class? If yes, then how?
Hi,
As per my knlowledge, we can't instantiate abstract classes directly, we must inherit the abstract classes. i mean we can't access a concrete method of an abstract class without inheriting the abstract class
Junior Member Array
- Join Date
- May 2007
- Answers
- 2
In order to access methods of an abstract class we need to extend the class first
Thanks
Rammy
Junior Member Array
- Join Date
- Nov 2007
- Answers
- 1
By declaring the methods as static., you can access the methods by using the class name without reference.
Joseph you are correct, by declaring the method as static we can access a concrete method of abstract class.
No we cant call without intilizing
Junior Member Array
- Join Date
- Sep 2008
- Answers
- 2
Yes but only static method in abstract class
You can define static method in abstract class that method do not need any object for this class while calling.
abstract class MyOne
{
public static void show()
{
System.out.println("Abstract show");
}
}
public class ShowMain
{
public static void main(String[] args)
{
MyOne.show();
}
}
We cannt create an object of an Abstract class..
Junior Member Array
- Join Date
- Jul 2010
- Answers
- 7
"yes,ssprastogi is right.we can do it.thanx i was not knowing it"
- Sponsored Ads
Latest Article