Programming Reference/Librarys
Question & Answer
Q&A is closed
This is an old revision of the document!
for ( init; condition; increment ){ statements; }
a for loop do statements while the condition is true/untrue, the increment counts the loop, it is possible to use more than 1 condition in the for loop
package codereferececomjava; public class CodeRefereceComJava { public static void main(String[] args) { int myOtherCount=5; for (int i = 0; i <= myOtherCount; i++) { System.out.println("i is: "+ i + " <= " + myOtherCount ); } } }
i is: 0 <= 5 i is: 1 <= 5 i is: 2 <= 5 i is: 3 <= 5 i is: 4 <= 5 i is: 5 <= 5