Hi,
Several times I have forgotten something like below:
public class MyClassA
{
private MyClassB classB;
private int A, B , C;
public MyClassA()
{
A = 1;
B = 2;
C = 99;
//several times I forgot the following line. To my surprise, I
was not warned by Eclipse. It took me a while to find out why my program
is not working. How can I set Eclipse to give me a warning.
classB = new ClassB();
}
public void doIt()
{
classB.method1();
}
}
Another class
public class Test
{
public static void main(String[] args)
{
MyClassA classA = new MyClassA();
classA.doIt(); //since I forgot to initialize classB inside
MyClassA code, this won't work. And it is time consuming for me to find
it out.
}
}