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 2 of 2

Thread: number of object formed of a class implenting a interface

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

    Post number of object formed of a class implenting a interface

    Given:
    3. interface Animal { void makeNoise(); }
    4. class Horse implements Animal {
    5. Long weight = 1200L;
    6. public void makeNoise() { System.out.println("whinny"); }
    7. }
    8. public class Icelandic extends Horse {
    9. public void makeNoise() { System.out.println("vinny"); }
    10. public static void main(String[] args) {
    11. Icelandic i1 = new Icelandic();
    12. Icelandic i2 = new Icelandic();
    12. Icelandic i3 = new Icelandic();
    13. i3 = i1; i1 = i2; i2 = null; i3 = i1;
    14. }
    15. }
    When line 14 is reached, how many objects are eligible for the garbage collector?
    A. 0
    B. 1
    C. 2
    D. 3
    E. 4
    F. 6


  2. #2
    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: number of object formed of a class implenting a interface

    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.

    We won't do your homework for you. If you'd like to post what you think the answer is with the reason you chose that answer and then ask our opinions, you may get responses. May.

Similar Threads

  1. Replies: 2
    Last Post: April 8th, 2014, 12:05 PM
  2. [SOLVED] Need help, Object Oriented / Class & Object.
    By jedmustdie in forum What's Wrong With My Code?
    Replies: 2
    Last Post: February 23rd, 2014, 10:21 PM
  3. Need help implenting arrays and method call into existing code
    By hoven in forum What's Wrong With My Code?
    Replies: 0
    Last Post: January 31st, 2011, 01:36 AM
  4. non well-formed output
    By luca.santaniello in forum Web Frameworks
    Replies: 1
    Last Post: November 19th, 2009, 03:52 AM
  5. Error of "class or interface expected" at Mylong class for problem of API's
    By lostgoat in forum What's Wrong With My Code?
    Replies: 3
    Last Post: July 22nd, 2009, 08:28 PM

Tags for this Thread