• Post Reply Bookmark Topic Watch Topic
  • New Topic

an obj created in class level and an obj created in constructor ?

 
Edward Chen
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
from thread point of view, what is difference between an obj created in class level and an obj created in constructor? for example, here the obj and obj1.

Thanks.

 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24213
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From any point of view, there's no difference at all; the compiler will put the code to initialize both variables into the constructor, after the call to the superclass constructor; the code for each variable will be identical.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!