Loops In Java With Examples - MeraForum Community.No 1 Pakistani Forum Community

MeraForum Community.No 1 Pakistani Forum Community

link| link| link
MeraForum Community.No 1 Pakistani Forum Community » The World of Information » Computer and Information Technology » Java » Loops In Java With Examples
Java All about Java Programs

Advertisement
 
Post New Thread  Reply
 
Thread Tools Display Modes
(#1)
Old
Morash's Avatar
Morash Morash is offline
 


Posts: 17,781
My Photos: ()
Country:
Star Sign:
Join Date: Jul 2010
Location: ▌║█║▌│█│║▌║
Gender: Male
cool Loops In Java With Examples - >>   Show Printable Version  Show Printable Version   Email this Page  Email this Page   04-12-2014, 01:07 AM




Loops

A Statement Or A Set Of Statements That Is Executed Repeatedly Is Called Loop. The Statement In A Loop Are Executed For A Specified Number Of Times Or Until Some Given Condition Remains True.



Kinds

for Loop
while Loop
do-while Loop




for Loop

for Loop Is Used To Execute A Set Of Statements Repeatedly For A Fixed Number Of Times. It Has Some Parts, They Are;

Initialization
Condition
Increment Of Decrement
Body Of The Loop




Syntax

for ( initialization; condition; increment/decrement)
{
Statement;
}



Example







while Loop

It Is A Conditional Loop Statement Used To Execute A Statement Or A Set Of Statements As Long As The Given Condition Remains True. After Executing The Statements Under 'while' The Control Shifts Back To 'while'
And The Condition Is Tested Again. If The Given Condition Becomes False At Any Stage During Execution, The Execution Of The Body Of Loop Is Terminated And Control Shifts To The Statement That Comes Immediately After The Body Of The Loop.


Syntax

while (condition)
{
Statement;
}


Example







do-while Loop

It Is Also A Conditional Loop Statement. It Is Like while Loop But In This The Condition Is Tested After Executing The Statement Of The Loop. In do-while Loop The Body Of The Loop Is Executed At Least Once Before The Condition Is Tested.
It Is Repeatedly Executed As Long As The Test Condition Remains True.


Syntax

do
{
Statement;
}
while(condition);



Example





 





bE driveN wiTh puRpOse, Be r313n71355 in your alιgnмenт;
with excellence.
pAy n0 mInd to the ∂ιsιмραssισηε∂ เ๓ק๏tєภt ђคtєгร

.. нoolιgan
Reply With Quote Share on facebook
Sponsored Links
(#2)
Old
Flower~ Flower~ is offline
 


Posts: 14,110
My Photos: ()
Country:
Star Sign:
Join Date: Aug 2011
Location: pakistan
Gender: Female
Default Re: Loops In Java With Examples - >>   Show Printable Version  Show Printable Version   Email this Page  Email this Page   04-12-2014, 10:41 AM


v nice

 




~“She said, Never forget me
as if the coast
could forget the ocean
or the lung
could forget the breath
or the earth
could forget the sun,”~
(#3)
Old
PRINCE SHAAN PRINCE SHAAN is offline
 


Posts: 7,688
My Photos: ()
Country:
Join Date: Jul 2010
Location: PAKISTAN
Gender: Male
Default Re: Loops In Java With Examples - >>   Show Printable Version  Show Printable Version   Email this Page  Email this Page   04-12-2014, 10:52 AM

Very nice sharing dear......................

 

(#4)
Old
Akash Akash is offline
The Bold And Beautiful
 


Posts: 1,111
My Photos: ()
Country:
Star Sign:
Join Date: Feb 2014
Location: Peshawar
Gender: Male
Default Re: Loops In Java With Examples - >>   Show Printable Version  Show Printable Version   Email this Page  Email this Page   04-12-2014, 10:52 AM

 






(#5)
Old
AYAZ's Avatar
AYAZ AYAZ is offline
 


Posts: 12,370
My Photos: ()
Country:
Star Sign:
Join Date: Aug 2008
Location: Karachi
Gender: Male
Default Re: Loops In Java With Examples - >>   Show Printable Version  Show Printable Version   Email this Page  Email this Page   04-12-2014, 09:29 PM

Thanks morash for sharing such easily tutorial with examples.

 







ALLAH FARMATA HAI :
AEY BANDEY JO HUA
WO ACHA HUA .
JO HORAHA HAI ACHA HO RAHA HAI.
JO HOGA WO BHI ACHA HOGA.
TERA KIYA GAIYA JO TU ROTA HAI
TU KIA LAYA JO TU NE KHO DIYA.
JO LIYA YAHIN (DUNYA) SEI LIYA
JO DIYA YAHIN (DUNYA) PE DIYA
JO AAJ TERA HAI PEHLAY KISI AUR KA THA
AUR KAL KISI AUR KA HOGA.
TABDEELI KAINAAT KA MAMOOL HAI
BAS TU WO JAMA KAR JO TU SATH LEI KAR JANEY WALA HAI
YANI NAIK AMAAL.


(#6)
Old
Morash's Avatar
Morash Morash is offline
 


Posts: 17,781
My Photos: ()
Country:
Star Sign:
Join Date: Jul 2010
Location: ▌║█║▌│█│║▌║
Gender: Male
Default Re: Loops In Java With Examples - >>   Show Printable Version  Show Printable Version   Email this Page  Email this Page   04-13-2014, 11:53 AM

Thanks All .

 





bE driveN wiTh puRpOse, Be r313n71355 in your alιgnмenт;
with excellence.
pAy n0 mInd to the ∂ιsιмραssισηε∂ เ๓ק๏tєภt ђคtєгร

.. нoolιgan
Post New Thread  Reply

Bookmarks

Tags
examples, java, loops

« Previous Thread | Next Thread »
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
~!~ [ Magical Examples Of Levitation Photography... ] ~!~ ~!~hasnain~!~ Pics And Images 11 02-07-2012 06:52 PM
~!~ [ Tremendous Examples of Eye Manipulation... ] ~!~ ~!~hasnain~!~ Pics And Images 14 01-31-2012 09:09 PM
Examples of stupid questions people ask. (¯`·._.·[FåIтH]·._.·´¯) Jokes 18 10-15-2011 12:27 AM


All times are GMT +5. The time now is 02:49 PM.
Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.

All the logos and copyrights are the property of their respective owners. All stuff found on this site is posted by members / users and displayed here as they are believed to be in the "public domain". If you are the rightful owner of any content posted here, and object to them being displayed, please contact us and it will be removed promptly.

Nav Item BG