while(10 > 1)
{
System.out.println("This prints forever.");
}
?
Identify the problem that exists in the above while loop.
What will be an ideal response?
The above code is an infinite loop. The expression 10 > 1 will always evaluate to true. Since this expression is part of a while loop, the body of the loop is entered and "Enter a new value" is displayed. Next, the expression is evaluated again. The expression 10 > 1 is still true, so the body is entered again. "Enter a new value" is displayed repeatedly. The loop never finishes because 10 > 1 is never false.
You might also like to view...
Answer the following statements true (T) or false (F)
1. An unnamed namespace provides a facility for collecting names that are local to the file where the unnamed namespace is located. Such names are available in that file, and are unavailable in any other file. 2. A function defined inside an unnamed namespace requires qualification. 3. You can use the static qualifier with a global function, class or variable to get the same effect as an unnamed namespace. 4. In a particular file, the names from the global namespace and names from an unnamed namespace defined in the file are accesses the same way: by writing the name.
Produce use case diagrams and a set of associated sequence diagrams for the Easy Drive School of Motoring case study documented in Appendix B.2.
What will be an ideal response?
Microsoft Internet Explorer supports ________ programs for the purpose of providing additional functionality to Web sites
A) certificate authority B) phishing C) disintermediation D) Active X
A Web server in Apache is limited to 100 aliases.
Answer the following statement true (T) or false (F)