java - In inheritance, when an object is created for subclass, is an object also created for its superclass? -


  1. in inheritance, when object created subclass, object created superclass?
    find answer above question yes, created. right?

  2. based on assumption right, solved question , found answer 4. right?

  3. is long primitive type or wrapper class?

question : when last brace reached, how many objects eligible garbage collection?

interface animal {    void makenoise();  }  class horse implements animal { long weight = 1200l;//here long primitive variable or wrapper class??                     //if wrapper class object, think answer                        // question 6   public void makenoise() { system.out.println("whinny"); } }  public class icelandic extends horse {  public void makenoise() { system.out.println("vinny"); }  public static void main(string[] args) { icelandic i1 = new icelandic(); icelandic i2 = new icelandic(); icelandic i3 = new icelandic();  i3 = i1; i1 = i2; i2 = null; i3 = i1; } } 

in inheritance, when object created subclass, object created superclass? find answer above question yes, created.am right?

no, won't create super class object when create sub class object. sub class object have super class functionalists inheriting super class. 1 object created when create sub class object

is long primitive type or wrapper class??

long primitive data type, long corresponding wrapper class.

question : when last brace reached, how many objects eligible garbage collection?

yes, there 6 objects, including 3 long objects


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -