Answers for "shortened for loop java"

15

java loop

for (int i = 0; i < 5; i++) {
  System.out.println(i);
}
Posted by: Guest on December-10-2019
9

java loop

for (int i = 0; i < 10; i++) {
  System.out.println(i);
}
Posted by: Guest on February-19-2020
0

labeled for loop in java

//WithLabelledLoop.java

    class WithLabelledLoop
    {
        public static void main(String args[])
        {
            int i,j;

            loop1:   for(i=1;i<=10;i++)
            {
                System.out.println();

                loop2:   for(j=1;j<=10;j++)
                {
                    System.out.print(j + " ");

                    if(j==5)
                        break loop1;     //Statement 1
                }
            }
        }
    }

    Output :

                1 2 3 4 5
Posted by: Guest on November-27-2019

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language