tag:blogger.com,1999:blog-2973787519736718861.post3385320168164385417..comments2024-03-13T05:54:14.145-07:00Comments on Software testing tutorials and automation: while, do while Loops - Basic Java Tutorials For Selenium WebDriverUnknownnoreply@blogger.comBlogger8125tag:blogger.com,1999:blog-2973787519736718861.post-6278197697573020222016-02-12T16:52:56.050-08:002016-02-12T16:52:56.050-08:00the statement i like is if you forget to include i...the statement i like is if you forget to include increment or decrement statement it goes in infinite loop....Anonymoushttps://www.blogger.com/profile/16654391116152940499noreply@blogger.comtag:blogger.com,1999:blog-2973787519736718861.post-50545706989964037032015-07-06T06:37:22.883-07:002015-07-06T06:37:22.883-07:00Thanks a lot for explaining in a great mannerThanks a lot for explaining in a great mannersantoohttps://www.blogger.com/profile/14609547589563004851noreply@blogger.comtag:blogger.com,1999:blog-2973787519736718861.post-29961217370946582662015-07-06T06:36:40.648-07:002015-07-06T06:36:40.648-07:00Thanks a lot for explaining while n do while funct...Thanks a lot for explaining while n do while functionality in a great manner...santoohttps://www.blogger.com/profile/14609547589563004851noreply@blogger.comtag:blogger.com,1999:blog-2973787519736718861.post-83915851931717877362015-02-17T17:14:24.120-08:002015-02-17T17:14:24.120-08:00as simple as that, as per your code,
first it pri...as simple as that, as per your code, <br />first it prints value of j which is ZERO<br />then the statement j=j-1 which is j=0-1 ; so now value of j is -1<br />then it checks the condition j>0 ; -1 > 0 NO. hence it comes out of loop and so the final output is just 0Anonymoushttps://www.blogger.com/profile/03628710856803488849noreply@blogger.comtag:blogger.com,1999:blog-2973787519736718861.post-60578648543647697942014-09-30T03:52:13.965-07:002014-09-30T03:52:13.965-07:00Nothing to display ie it mean 0Nothing to display ie it mean 0Anonymoushttps://www.blogger.com/profile/14984837761320574012noreply@blogger.comtag:blogger.com,1999:blog-2973787519736718861.post-55061824990909581462014-06-13T11:39:40.805-07:002014-06-13T11:39:40.805-07:00Output : Value Of Variable j Is 0.
only the first...Output : Value Of Variable j Is 0.<br /><br />only the first iteration is done for a do while loop as it is a exit condition loop, which means the complex statement inside the do segment would be executed first. then the condition is checked. If the condition is satisfied then the statement inside the do segment would again be executed first .Else, if the condition is not satisfied, then it exits the loop. Hence called an exit condition loop.Shankarhttps://www.blogger.com/profile/05979851064228623049noreply@blogger.comtag:blogger.com,1999:blog-2973787519736718861.post-70637852278817492492014-06-10T23:23:28.228-07:002014-06-10T23:23:28.228-07:00do while Loop
Same as while loop, do while loop wi...do while Loop<br />Same as while loop, do while loop will be executed till the condition returns true.<br />Example :<br /> int j=0;<br /> do{<br /> System.out.println("Value Of Variable j Is "+j);<br /> j=j-1;<br /> }while(j>0);<br /><br />what is the output of the above code? Please explainMrudulahttps://www.blogger.com/profile/12620785859067887236noreply@blogger.comtag:blogger.com,1999:blog-2973787519736718861.post-82847904961698313852014-06-10T23:22:50.167-07:002014-06-10T23:22:50.167-07:00do while Loop
Same as while loop, do while loop wi...do while Loop<br />Same as while loop, do while loop will be executed till the condition returns true.<br />Example :<br /> int j=0;<br /> do{<br /> System.out.println("Value Of Variable j Is "+j);<br /> j=j-1;<br /> }while(j>0);<br /><br />What is the output of the above code? Please explainMrudulahttps://www.blogger.com/profile/12620785859067887236noreply@blogger.com