public class whileLoop { public static void main(String[ ] args) { int a = 10; while(a < 20); System | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

public class whileLoop { public static void main(String[ ] args) { int a = 10; while(a < 20); System

pls is anytin wrong wt dis code?

23rd Jun 2017, 8:59 AM
Goodnews Oburu
Goodnews Oburu - avatar
1 Answer
0
Yes, you have infinite while loop. You need to put some code below while, for example: while(a<20) { System.out.print( a ); a--; } Note: -System is a final class from the java.lang package. -out is a class variable of type PrintStream declared in the System class. -print is a method of the PrintStream class.
23rd Jun 2017, 9:39 AM
Majstor_Gile
Majstor_Gile - avatar