Looping Statements
Learn Looping Statements (Java Basics, Java) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
1. Introduction A loop repeats a block of code while a condition stays true One run of the body is an iteration. Java has for (known count), while (condition first), do-while (at least once) and the enhanced for-each over arrays and collections , each built from initialization, condition and update. Enhanced for over an array compiles to an index loop, over an Iterable to an Iterator, and break and continue control the flow.
More lessons in Java Basics
- Introduction to Java
- Getting Started with Java (Installation & Setup)
- Features of Java
- Difference between JVM, JDK, JRE
- Data Types and Variables
- Access Specifiers
- Operators in Java
- Control Statements in Java
- Jumping Statements in Java
- Packages
- Array in Java
- Array Program
- String in Java
- Constructor in Java
- Constructor Chaining
- Static Keyword
- Input and Output Stream in Java
- Scanner in Java
- Serialization in Java
- Properties File in Java
- Final Keyword
- Wrapper Class
- Methods in Java
- Return Object from Method
- Different way to return to the method in java.
- This and Super Keywords