[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.newcomer] How can I set Eclipse to give me a warning on this error?
|
- From: www <www@xxxxxxxxxx>
- Date: Thu, 25 Jan 2007 09:36:53 -0500
- Newsgroups: eclipse.newcomer
- Organization: EclipseCorner
- User-agent: Thunderbird 1.5.0.9 (Windows/20061207)
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.
}
}