Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: when should we go for interface and abstract classes and concrete classes

  1. #1
    Junior Member
    Join Date
    Jul 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default when should we go for interface and abstract classes and concrete classes

    when should we go for interface and abstract classes and concrete classes please explain me with example

    Thanks
    akhil


  2. #2
    Senior Member
    Join Date
    Jul 2013
    Location
    Europe
    Posts
    666
    Thanks
    0
    Thanked 121 Times in 105 Posts

    Default Re: when should we go for interface and abstract classes and concrete classes

    Depends on your own personal opinion. There is no clear rule.
    I would, personally, create an abstract class if 2 top-level classes share the same code for more then one method.
    And I use interfaces whenever I go for a strategy- or decorator pattern. And in some other cases too, but it really depends.

  3. #3
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: when should we go for interface and abstract classes and concrete classes

    Thread moved.

    Welcome to the forum! Please read this topic to learn how to post code in code or highlight tags and other useful info for new members.

Similar Threads

  1. Abstract Classes?
    By jean28 in forum Java Theory & Questions
    Replies: 1
    Last Post: January 26th, 2013, 07:13 AM
  2. Abstract classes, and 'instanceOf'
    By jezza10181 in forum Object Oriented Programming
    Replies: 6
    Last Post: August 12th, 2012, 10:45 AM
  3. Issue with abstract classes
    By zaphod2003 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: February 7th, 2011, 02:25 AM
  4. [SOLVED] Abstract Classes Help
    By SweetyStacey in forum Object Oriented Programming
    Replies: 10
    Last Post: May 6th, 2010, 06:15 AM
  5. Java program with abstract class along with two subclasses
    By crazydeo in forum Collections and Generics
    Replies: 2
    Last Post: June 10th, 2008, 11:45 AM