loops on java code example
Example 1: Java for loop
int values[] = {1,2,3,4};
for(int i = 0; i < values.length; i++)
{
System.out.println(values[i]);
}
Example 2: for loop java
for (int i = 0; i < 5; i++) {
System.out.println(i);
}
int values[] = {1,2,3,4};
for(int i = 0; i < values.length; i++)
{
System.out.println(values[i]);
}
for (int i = 0; i < 5; i++) {
System.out.println(i);
}