what is difference between following variable usages
public class A{
B b= new B();
public void doSomething()
{
b.callme();
}
}
VS
public class A {
B b;
public void doSomething() {
b=new B();
b.callme();
}
}
if we have single "b" inside a class then which one is better practice and why.
and under what circumstances one whould be used.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…