For loop
for(initialization; condition ; increment/decrement)
{
statement(s);
}Пример:
class ForLoopExample {
public static void main(String[] args){
for(int i=10; i>1; i--){
System.out.println("The value of i is: "+i);
}
}
}The value of i is: 10
The value of i is: 9
The value of i is: 8
The value of i is: 7
The value of i is: 6
The value of i is: 5
The value of i is: 4
The value of i is: 3
The value of i is: 2Безкраен циъл:
ППример с array:
Last updated