Our Online Store have the new products: RFID antenna board. Currently it can work with JC10M24R and JCOP4 card chips.
Compared with normal cards, the antenna board module has a smaller size and fixed holes, which is easy to integrate in the IOT(Internet Of Things) project.

What happens with the x variable in the "for" loop?

JavaCard Applet Development Related Questions and Answers.
Heather
Posts: 24
Joined: Mon Nov 30, 2015 5:41 am
Points :121
Contact:

What happens with the x variable in the "for" loop?

Post by Heather » Mon Nov 30, 2015 5:59 am

As we all know, JCVM doesn't have garbage collector. So in a for loop:

Code: Select all

for(short x=0;x<5;x++)
{
}

Does the x variable get utilized after the for loop, or it turns into garbage? What happens with the x variable in the for loop?

kuafu
Posts: 317
Joined: Thu Jun 25, 2015 2:09 am
Points :4551
Contact:

Re: What happens with the x variable in the "for" loop?

Post by kuafu » Mon Nov 30, 2015 6:25 am

x is a local variable , and its type is base type .So it's allocated in RAM. It will be recycled after the method or the block end. Its recycle is different with the reference type variable alloacated in EEPROM . It's recycle is faster . And most of the reference type is allocate in EEPROM, garbage the reference type cost much time.
well

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 45 guests

JavaCard OS : Disclaimer