Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

May ont have been initialized?

Status
Not open for further replies.

ArashB

Programmer
Dec 24, 2005
10
CA
I receive the following error

The local variable XXX may not have been initialized

Please let me know what it means and how I can initialize it.
 
Code:
int a;

if (b) a = 7;
System.out.println ("This a might not have been initialized (if b is false): " + a);
Use a default value, if appropriate.
For objects you may choose Foo foo = null;, if you can guarantee, it will not stay null, but the compiler doesn't realize.

seeking a job as java-programmer in Berlin:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top