Skipping down to the next 'else'

Hello,

I am wondering, as a conventience method, if there is any way to skip down to the next 'else' in an if-else block. For instance, I want to be able to write a code in the following way:

if (A exists){

int B = A.complexProcess();

int C = B.complexProcess();

if (C is not valid)

// *** skip down to the next else

int D = C.complexProcess();

}else{

do somethingelse

}

Now, granted I could write it as

int C = 0;

boolean CisValid =false;

if (A exists){

int B = A.complexProcess();

C = B.complexProcess();

if (C is valid)

CisValid =true;

}

if (CisValid){

int D = C.complexProcess();

}else{

do somethingelse

}

however, this seems to be rather more complicated.

Soo.... is there a way to do the first version?

Thanks!

Sam

[1866 byte] By [Wooba] at [2007-11-27 3:22:07]
# 1
try switch statements... anyway the 2nd way is better i think.... BTW, you may want to make the 2nd if statement nestedMessage was edited by: rdeva
rdevaa at 2007-7-12 8:24:53 > top of Java-index,Java Essentials,New To Java...
# 2

if (A exists){

int B = A.complexProcess();

int C = B.complexProcess();

if (C is not valid)

doSomethingElse(...);

else {

int D = C.complexProcess();

}

} else {

doSomethingElse(...);

}

...

private void doSomethingElse(...) {...}

DrLaszloJamfa at 2007-7-12 8:24:53 > top of Java-index,Java Essentials,New To Java...