>I am not sure my question is valid or not. It is the following:
>public class MyClass {
[quoted text clipped - 8 lines]
> }
>}
www wrote:
>> I am not sure my question is valid or not. It is the following:
>> public class MyClass {
[quoted text clipped - 8 lines]
>> }
>> }
Please do not embed TABs in Usenet posts.
> This isn't possible. It's also very much against the grain of structured
> programming - doB can not know that it's called only from within doA, so it
> can't access locals that only exist in doA.
>
> Find another way to design your class such that scope of data elements is
> cleaner.
As with so many programming problems, one can redefine the problem to achieve
the result.
Instead of an int, define a holder:
public class MyClass
{
static class Holder
{
public int num;
}
public void doA()
{
Holder h = new Holder();
h.num = 17;
doB( h );
}
public void doB( Holder hold )
{
hold.num *= 2;
}
}
Of course, within a single class this makes little sense. The usual approach
there is to use an instance variable. But for creating an OUT variable
between objects of different types the holder idiom works well.

Signature
Lew