java - In inheritance, when an object is created for subclass, is an object also created for its superclass? -
in inheritance, when object created subclass, object created superclass?
find answer above question yes, created. right?based on assumption right, solved question , found answer 4. right?
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
Post a Comment