SEARCH
🇬🇧
MEM
O
RY
.COM
4.37.48
Guest
Log In
Â
Homepage
0
0
0
0
0
Create Course
Courses
Last Played
Dashboard
Notifications
Classrooms
Folders
Exams
Custom Exams
Help
Leaderboard
Shop
Awards
Forum
Friends
Subjects
Dark mode
User ID: 999999
Version: 4.37.48
www.memory.co.uk
You are in browse mode. You must login to use
MEM
O
RY
  Log in to start
Index
 »Â
Java Interview
 »Â
Chapter 1
 »Â
Loops
level: Loops
Questions and Answers List
level questions: Loops
Question
Answer
Break Statements breaks out of the inner most loop (can define loops using labels "outer: for(,,,) break outer;
Break
Continue Statements skips rest of the statements in inner most loop (can define loops using labels "outer: for(,,,) break outer;
Continue
Do while is used when its not clear how many times loop has to be executed. Code in do whole is executed alteast once.
Do while
For Loop: need to specify the loop bounds( minimum or maximum). For each: do not need to specify the loop bounds minimum or maximum. It repeats statements for each element in an array or an object collection.
For loop vs For Each*
While is used when it is not clear how many times loop has to be executed.Depending on the condition, code in while might not be executed at all
While loop