[program-java] Re: Local variable

Hi:

The error occurs in case 2, but since writing the message I determined
that even though I always hit case 0, the table object is out of scope
on the case 2....

Many thanks.

Jim  

-----Original Message-----
From: program-java-bounce@xxxxxxxxxxxxx
[mailto:program-java-bounce@xxxxxxxxxxxxx] On Behalf Of Adrian Beech
Sent: January 27, 2009 04:33
To: program-java@xxxxxxxxxxxxx
Subject: [program-java] Re: Local variable 

G'day Jim,

Where is the error being reported, i.e. in the case 0, 1 or 2 blocks of
the switch statement?  If in the case 2 block then maybe casting would
overcome the compile time error, a long shot me thinks though?  Hmmmmmm,
perhaps some code fragments would help to shed a bit of light on the
issue?  I often find it easier to read through code and say "yeah thats
where the sucker is broken".... etc.

BTW, would I be right in recalling from a side comment from one of your
prior postings to this group you like a sip or two of the Irish?  A non
Java question then if this is the case... what's better than Bush Mills
Black Bush?

Cheers.
AB

-----Original Message-----
From: program-java-bounce@xxxxxxxxxxxxx
[mailto:program-java-bounce@xxxxxxxxxxxxx] On Behalf Of Corbett, James
Sent: Tuesday, 27 January 2009 3:24 AM
To: program-java@xxxxxxxxxxxxx
Subject: [program-java] Local variable 

Hello all:

I have a locally declared variable table;

Private Table table = null;

I also have a method that has a Switch statement that has three cases.
In case 0, I initially create the table and set the TableColumns.

In case 1, I create the same situation as in case 0 but now I actually
add the TableItems.

In case 2, the table has already been created in either case 0 or 1 so
in this circumstance all I do is update the TableItems by either adding
or deleting the item.

However upon compiling I get the following error:

"The local variable table may not have been initialized".

Here's the rub, case 0 no matter the circumstance will always be run
during the initial build of my screen or shell. So in other words, the
table is initialized.

What gives?

J.

James M. Corbett

A / Technical Specialist
GST/HST Micros | Micros de la TPS/TVH

(613) 941-1338



__________ NOD32 3802 (20090126) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com




Other related posts: