Bojan P

Bojan P

  • NA
  • 1
  • 11.7k

Difference between instantiate object in class and in constructor of class?

Jan 14 2011 2:49 PM
Is this a same thing? If not, what is the difference?

public class WhatEver{
   SomeClass cl = new SomeClass();
    //constructor
    public WhatEver();
}



public class WhatEver{
    //constructor
    public WhatEver() {
      SomeClass cl = new SomeClass();
     }

}


Answers (1)