Is there any advantage for either approach?
Example 1:
class A { B b = new B(); }
Example 2:
class A { B b;
Both of the methods are acceptable. Note that in the latter case b=new B() may not get initialized if there is another constructor present. Think of initializer code outside constructor as a common constructor and the code is executed.
b=new B()