Process finished with exit code 130 (interrupted by signal 2: SIGINT) Intellij idea

已回答

i have the last version of intellij idea, and jdk 10. I have a problem with simple code like this.

int i = 0;
do{
if(i==5)
continue;
System.out.println(++i);

}while(i<10);

because continue doesn't work, it write 1,2,3,4,5 to console and that's all. I have to stop the compiler manually. 

But this code works correctly.

int [] numbers = {10, 20, 30, 40, 50};

for(int x : numbers ) {
if( x == 30 ) {
continue;
}
System.out.print( x );
System.out.print("\n");
}

what am I doing wrong?

0

Hello,

"continue" works fine, it moves you outside do block without executing

System.out.println(++i);

So then it hangs in a loop where i=5.

You could replace "continue" with "break" to exit do-while loop when i=5.

0

I have the same issue

0
Could you please elaborate on your issue here with a code sample? Have you tried the above suggestion?
0

请先登录再写评论。