This is most basis Java Puzzler. Question is, how will the output look like ?
- Will it print out powers of 10 starting from 1 ending at 10000000.
- Or will it print just 1.
- Or will it print any other number.
- Or will it loop forever.
- Or anything else.
package sk.adino.puzzlers;
import static org.junit.Assert.*;
import org.junit.Test;
public class AutoboxingTest {
@Test
public void test() {
int i=1;
while(i<10000000) {
System.out.println("value:" + i);
Integer j=i;
Integer k=i;
if (j==k){
i=i*10;
}else break;
}
assertEquals(i,1000);
}
}