#240 Problem to continue to a label

open
nobody
None
5
2005-08-10
2005-08-10
Nigel
No

> cat t95.java
class t95 {
public static void main(String[] args) {
char[] c = {78, 105, 103, 101, 108, 32, 105, 115, 32,
98, 101, 115, 116};
outer :
for (int i = 0; i < 13; i++)
for (int j = 0; j < 13; j++) {
if (j > i) {
System.out.println();
continue outer;
}
System.out.print(c[j]);
}
System.out.println();
}
}

Process cat exited with code 0

Compiled and executed in Java produces:

> javac t95.java
Process javac exited with code 0
> java t95
N
Ni
Nig
Nige
Nigel
Nigel
Nigel i
Nigel is
Nigel is
Nigel is b
Nigel is be
Nigel is bes
Nigel is best
Process java exited with code 0

BeanShell has problems with the continue:

> java -classpath /opt/bsh-2.0b5.jar bsh.Interpreter
t95.java
N

Ni

Nig

Nige

Nigel

Nigel

Nigel i

Nigel is

Nigel is

Nigel is b

Nigel is be

Nigel is bes
Nigel is best
Process java exited with code 0

Discussion


Log in to post a comment.