Can a class in java be private? Is null a keyword in java? What is the initial state of a thread when it is started? What is the super class for Exception and Error? What is Class. Can interface be final? What is the difference between exception and error? What is default value of a local variables? What is local class in java? Can we initialise uninitialized final variable? Can we declare abstract method as final? Can we have finally block without catch block?
What is pass by value and pass by reference? Can we declare main method as private? What is the difference between preemptive scheduling and time slicing? Can non-static member classes Local classes have static members? What are the environment variables do we neet to set to run Java?
Can you serialize static fields of a class? What is the difference between declaring a variable and defining a variable? Where can we use serialization? What modifiers are allowed for methods in an Interface? What is the purpose of Runtime and System class? Which one is faster? ArrayList or Vector? What is the difference between static synchronized and synchronized methods?
What is the order of catch blocks when catching more than one exception? What is hashCode? What is the difference between Hashtable and HashMap? What are the restrictions when overriding a method? What is the use of assert keyword? What is adapter class?
What is difference between break, continue and return statements? What is the difference between while and do-while statements? I loved this page very nicely presented and easy answers with key points covered in it……. Your email address will not be published. Key Differences Between while and do-while Loop The while loop checks the condition at the starting of the loop and if the condition is satisfied statement inside the loop, is executed. As against, in the do-while loop, the condition is checked after the execution of all statements in the body of the loop.
If the condition in a while loop is false, not a single statement inside the loop is executed. The while loop is also known as the entry-controlled and pre-checking loop because in this loop, the body of the loop is executed prior to checking the condition. Conversely, the alternate name for the do-while loop is the exit-controlled and post-checking loop, the reason behind this is that the checking of the loop condition is followed by the execution of the body of the loop.
The syntax of a do-while loop includes a semi-colon to terminate the loop. On the contrary, there is no use of the semi-colon in the while loop syntax. Comments I loved this page very nicely presented and easy answers with key points covered in it……. Pascal is more clean and clear: Repeat …. This is how the understanding of loops should be taught!!!!!! Leave a Reply Cancel reply Your email address will not be published. The process repeats until the condition becomes false. Unlike the while loop which tests the condition before the code within the block is executed, the do-while loop is an exit-condition loop, in the sense that, the code must always be executed first and then the expression or test condition examined.
If it is true, the code executes the body of the loop again. If the expression is false, the loop terminates and control transfers to the statement following the do-while loop.
Viva Differences. What Are Loops? While Loop In computer programming languages, a while loop is a control flow statement that allows code to be executed repeatedly based on a given Boolean condition. Given that the condition is checked first, statements may or may not get executed.
0コメント