Este programa também me dá erro na execução;
O Programa;
class Prog0601
{
public static void main (String args[])
{
int i = 0;
int scap = 0;
String greetings[] = {“Hello word”,“No, I mean it!”,“HELLO WORLD!”};
[color=blue]While(i<4); **Esta esta linha apresenta erro...Por que?[/color] {
try
{
System.out.println(greetings[i]);
}
catch(ArrayIndexOutOfBoundsException e)
{
scap++;
System.out.println("Valor do Índice foi refixado" +scap);
if(scap<5)
{
i=-1;
}
}
catch(Exception e)
{
System.out.println(e.toString());
}
finally
{
System.out.println("Esta mensagem será sempre impressa.");
}
i++;
}
}
}
E R R O da execução:
Exception in thread “main” java.lang.Error: Unresolved compilation problem:
The method While(boolean) is undefined for the type Prog0601
at Prog0601.main(Prog0601.java:9