Bug in Netbeans Java compiler?

I think Netbeans (or Java itself?) has a major flaw in its compiler design.

Explain to me why the following code is not compilable. Specifically, why it should complain about line 8:

cannot find symbol

symbol : variable Selected

When I clearly declared it a couple lines above it!

Now the fact that it was declared in an "If" clause is a lame excuse, because there is an unconditional Else clause which ALSO declares the same Object array. So either way, the Object array gets declared exactly ONCE. Not zero, not twice. In

EVERY SINGLE LOGICAL CASE.

So why was someone on crack when they designed Java/Netbeans? This is a BS error.

1if (president.compareTo("Bush") == 0){

2Object Selected[] = listWarCriminals.getSelectedValues();

3}

4else{

5Object Selected[] = listPresidents.getSelectedValues();

6}

7

8for (int n=0; n<Selected.length; n++){

9name = Selected[n].toString();

10 JOptionPane.showMessageDialog(frame, name,"Result", JOptionPane.INFORMATION_MESSAGE);

11}

>

[1441 byte] By [CathInfoa] at [2007-11-27 5:24:33]
# 1
Please don't [url= http://forum.java.sun.com/thread.jspa?threadID=5176269&messageID=9681394#9681394]crosspost[/url]!
georgemca at 2007-7-12 11:50:45 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 2
> Please don't> [url= http://forum.java.sun.com/thread.jspa?threadID=51> 76269&messageID=9681394#9681394]crosspost[/url]!Although for a topic this stupid it can't be bad to share the love.
cotton.ma at 2007-7-12 11:50:45 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...