Exforsys
+ Reply to Thread
Page 1 of 2 12 LastLast
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?...

  1. #1
    maksy is offline Junior Member Array
    Join Date
    May 2007
    Answers
    1

    Abstract classes

    Can we call a concrete method of an abstract class, without inheriting the abstract class? If yes, then how?


  2. #2
    modiyam is offline Junior Member Array
    Join Date
    May 2007
    Answers
    1
    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


  3. #3
    rameshrise is offline 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


  4. #4
    josephraja1982 is offline 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.


  5. #5
    amitky is offline J2EE Prof. Array
    Join Date
    Dec 2007
    Location
    Bangalore
    Answers
    7
    Joseph you are correct, by declaring the method as static we can access a concrete method of abstract class.


  6. #6
    sampra is offline Junior Member Array
    Join Date
    Mar 2008
    Location
    bangalore
    Answers
    9
    No we cant call without intilizing


  7. #7
    ssprastogi is offline Junior Member Array
    Join Date
    Sep 2008
    Answers
    2

    Thumbs up 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();
    }

    }


  8. #8
    Bijay29 is offline Junior Member Array
    Join Date
    Jan 2009
    Answers
    2
    We cannt create an object of an Abstract class..


  9. #9
    sujeet.varshney is offline Junior Member Array
    Join Date
    Jul 2010
    Answers
    7

    No chance

    Quote Originally Posted by maksy View Post
    Can we call a concrete method of an abstract class, without inheriting the abstract class? If yes, then how?
    abstract classes can't be instantiated must be overridden by the derived classes to use and reimplement their methods


  10. #10
    jazzsona is offline Junior Member Array
    Join Date
    Jul 2010
    Answers
    1
    "yes,ssprastogi is right.we can do it.thanx i was not knowing it"


    •    Sponsored Ads



Latest Article

Network Security Risk Assessment and Measurement

Read More...