Als ik de onderstaande code wil uitvoeren krijg ik een dikke error. Maar naar mijn inzien zit er geen fout in mijn code. Weet iemand dit probleem te verhelpen???
De foutmelding die ik krijg is:
...............................................................................................................................
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Syntax error, 'for each' statements are only available if source level is 5.0
at ForEachInzend2.<init>(ForEachInzend2.java:8)
at ForEachInzend2.main(ForEachInzend2.java:16)
...............................................................................................................................
Groeten,
BartP
De foutmelding die ik krijg is:
...............................................................................................................................
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Syntax error, 'for each' statements are only available if source level is 5.0
at ForEachInzend2.<init>(ForEachInzend2.java:8)
at ForEachInzend2.main(ForEachInzend2.java:16)
...............................................................................................................................
Code:
public class ForEachInzend2 {
public ForEachInzend2(){
int[] celblock = new int[100];
int crimineel = 100;
for (int cel : celblock){
cel = crimineel;
crimineel++;
System.out.println("Criminelen in celblock " + cel);
}
}
public static void main(String[] args){
ForEachInzend2 foreachinzend2 = new ForEachInzend2();
}
}
Groeten,
BartP