BCEL and IfThenElse construct

T

Thomas Zangl

Hi,

I have some piece of code which I want to convert to Java using the
BCEL. Methodcalls etc work fine but now I am stuck with the "if then
else" structure.

Can someone please post an example for something simple like:

if y > x then
Foo()
else
Bar()

TIA!

Best regards,
 
?

=?ISO-8859-1?Q?Daniel_Sj=F6blom?=

Thomas said:
Hi,

I have some piece of code which I want to convert to Java using the
BCEL. Methodcalls etc work fine but now I am stuck with the "if then
else" structure.

It is unclear what exactly you want to convert to java. If you meant to
write java bytecode, then see below.
Can someone please post an example for something simple like:

if y > x then
Foo()
else
Bar()

Bytecode:

...
iload_y
iload_x
IF: if_icmple ELSE
invokexxx Foo
goto END_IF
ELSE:
invokexxx Bar
END_IF: ...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,234
Latest member
SkyeWeems

Latest Threads

Top