Bug 44172 - The local variable xxxx may not have been initialized
Summary: The local variable xxxx may not have been initialized
Status: CLOSED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 M4   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-10-04 11:51 EDT by Chemi CLA
Modified: 2003-10-05 15:45 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chemi CLA 2003-10-04 11:51:44 EDT
Hi, I have this snippet:

public static void main(String[] args)
{
  int a, b = 0;
  System.out.println(a);
  System.out.println(b);
}

and whn compiling it has two errors (the text from the summary).

The same thing but:

public static void main(String[] args)
{
  int a = 0;
  int b = 0;
  System.out.println(a);
  System.out.println(b);
}

compiles perfectly.

I understand this is a bug because both snippets are the same. Right?
Comment 1 Philipe Mulet CLA 2003-10-05 05:39:51 EDT
No, the multi variable declaration is only initializing 'b'. In order to 
initialize both, you should have written:

int a = 0, b = 0;
Comment 2 Chemi CLA 2003-10-05 15:45:08 EDT
Ok. Sorry, then it was a lack of knowledge in my part.