Quality Testing

Quality is delighting customers

Hi friends,
pls send me the code for infinite for loop

Views: 34

Reply to This

Replies to This Discussion

Following is the code,

 

for( ; ; ;)

{

Statements;

}

 

Hi Yar,
         go through the for loop example using java
  1. *
  2.   Infinite For loop Example
  3.   This Java Example shows how to create a for loop that runs infinite times
  4.   in Java program. It happens when the loop condition is always evaluated as true.
  5. */
  6.  
  7. public class InfiniteForLoop {
  8.  
  9. public static void main(String[] args) {
  10.  
  11. /*
  12.   * Its perfectely legal to skip any of the 3 parts of the for loop.
  13.   * Below given for loop will run infinite times.
  14.   */
  15. for(;;)
  16. System.out.println("Hello");
  17.  
  18. /*
  19.   * To terminate this program press ctrl + c in the console.
  20.   */
  21. }
  22. }
  23.  
  24. /*
  25. Output would be
  26. Hello
  27. Hello
  28. Hello
  29. Hello
  30. ..
  31. ..
  32. */
thanks,
abdul

Thankin g u abdul.

 

RSS

TTWT Magazine


Advertisement

Advertisement

Advertisement

Advertisement

© 2022   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service