is it because there is no false condition to stop the loop?Code :public class Sample { public static void main(String[] args) { int loopKey; int x = 1; while (false) { //unreachable statement. System.out.println("ZABDIEL"); } } }
Printable View
is it because there is no false condition to stop the loop?Code :public class Sample { public static void main(String[] args) { int loopKey; int x = 1; while (false) { //unreachable statement. System.out.println("ZABDIEL"); } } }
Since the condition block in the while will ALWAYS be false, the code in the while block can NEVER happen. Therefore, unreachable code block.
// Json
im doing that condition it do-while but it can reach that block.. but now Im starting to get it although a liitle bit
tnx for the reply with this post sir!
\m/
Yeah because in a do/while the code block will ALWAYS run once, no matter what the condition is.
// Json