Firstly what is looping statement?
So, looping statement are those statement which are executed more than one time repeatedly until the user want.
There are Three looping Statement in Java.
1) for loop.
2) while loop.
3) do while loop.
Lets understand them by their syntax.
1) for loop
for loop is a control flow statement for specifying iteration, which allows code to be executed repeatedly until the user wants.
Lets understand by one example:-
Here in the example we have initiated a class with name for_loop then we have main method in the main method we have for loop in that for loop we have statement in which i is initialize to 0 and i is less than 5 and i++ for incrementing the value of i. And in that for loop we have given a statement to print the value of i. Then we have completed the blocks and generated the output.
2) while loop
while loop is also a control flow statement that allows code to be executed repeatedly based on the given Boolean condition.
Lets understand by one example.
Here in the example we have initiated a class with name while_loop then we have main method in the main method we have initiated i=0 and after that we have while loop in that while loop we have statement in which i is less than 5 .And in that while loop we have given a statement to print the value of i and then incremented the value of i. Then we have completed the blocks and generated the output.
3) do while loop
Here in the example we have initiated a class with name do_while_loop then we have main method in the main method we have initiated i=0 and after that we have do while loop in that do while loop we have given a statement to print the value of i and then incremented the value of i. Then we have while block in which we have given that i is less than 5 then we completed the blocks and generated the output
Blogger bolteyyy
ReplyDeleteThanks sahilππΌππΌπ₯❤️
DeleteWow man nice work
ReplyDeleteThank you ππΌπ
DeleteHelpful
ReplyDeleteThank you ππΌπ
DeleteThanks buddyππΌπ
ReplyDeleteAwesome
ReplyDeleteAwesome π
ReplyDeleteπππ
ReplyDeleteNice bro
ReplyDeleteHelpful ππ
ReplyDeleteNice bro
ReplyDeleteKhatra Bhai pro bolteπ€π€
ReplyDelete