| Author |
while(true)
|
Phillipe Rodrigues
Ranch Hand
Joined: Oct 30, 2007
Posts: 165
|
|
I want to know the line no(1) execution. What the (1) check. What is the other way we can specify line no (1)
|
Thanks,
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12921
|
|
|
A while(true) loop is an infinite loop - the loop never terminates (at least, not until you stop the program).
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
Phillipe Rodrigues
Ranch Hand
Joined: Oct 30, 2007
Posts: 165
|
|
|
How can I write the line(1) using the If condition?
|
 |
Nickolas Case
Ranch Hand
Joined: Apr 26, 2008
Posts: 98
|
|
Set a boolean method and test on that.
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12921
|
|
Originally posted by Phillipe Rodrigues: How can I write the line(1) using the If condition?
You cannot, because if is not a looping construct like while. You could do this trick with for, but I don't recommend it, because it's more unreadable than the version with while: [ June 04, 2008: Message edited by: Jesper Young ]
|
 |
Phillipe Rodrigues
Ranch Hand
Joined: Oct 30, 2007
Posts: 165
|
|
while(true) means ? is it saying while the run() is getting executed or what while(true) checks.when the while condition executes?
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24054
|
|
Originally posted by Phillipe Rodrigues: while(true) means ?
It just literally means that as long as true == true, the loop will continue. Since true is always equal to true, it means "loop forever."
|
[Jess in Action][AskingGoodQuestions]
|
 |
 |
|
|
subject: while(true)
|
|
|