+ 4

Where is error in Java program (comment 1 or 2 or 3)?

// Where is error in Java program (comment 1 or 2 or 3)? public class Program { public static void main(String[] args) { label: { // 1 break label; // 2 continue label; // 3 }}}

29th May 2019, 7:30 PM
Андрей Чачин, Andrew Chachin
Андрей Чачин, Andrew Chachin - avatar
2 Antworten
+ 13
Error in 3, because continue must be inside a loop
29th May 2019, 7:42 PM
Javier Felipe Toribio
Javier Felipe Toribio - avatar
+ 2
break label will exit loop, continue is unreachable code
29th May 2019, 7:44 PM
HNNX 🐿
HNNX 🐿 - avatar