Tuesday, 18 March 2025

Contact Info

  • ADDRESS: 851, LG, Sector 3F, Sector 3, Vaishali, Ghaziabad, Uttar Pradesh 201010

  • PHONE: +91 7986794481

  • E-MAIL: contact@technicalspeaks.com

  • Home  
  • Loops in Java | Java Tutorial | For | While | For-Each | Do-While | Looping in Java
- core java

Loops in Java | Java Tutorial | For | While | For-Each | Do-While | Looping in Java

Loops in any programming language are used to execute or run a set of instructions also called functions continually until the conditions become true. In the Java programming language, basically, four types of loops: For Loops For-Each Loops While Loops Do-While Loops 1.For Loops: 2.For-Each Loops To Know the Functionality of the Loops, Just watch […]

Loops in any programming language are used to execute or run a set of instructions also called functions continually until the conditions become true.

In the Java programming language, basically, four types of loops:

  1. For Loops
  2. For-Each Loops
  3. While Loops
  4. Do-While Loops

1.For Loops:

public class Loops {

public static void main(String[] args){

// here first I will declare an array like

int[] array = {1,2,3,4,5,6,7,8};

for(int i =0;  i<8;  i++){

System.out.println(array[i]);

}

}

}

2.For-Each Loops

public class Loops {

public static void main(String[] args){

// here first I will declare an array like

int[] array = {1,2,3,4,5,6,7,8};

for(int i :array){

System.out.println(i);

}

}

}

To Know the Functionality of the Loops, Just watch the video, where you can find the step to step-wise tutorials on Loops Operations in Java:

3. While Loops:

public class Loops {

public static void main(String[] args){

// here first I will declare an array like

int[] array = {1,2,3,4,5,6,7,8};

int i =0;

while(i<array.length){

System.out.println(array[i]);

i++;

}

}

}

4. Do-While Loops:

public class Loops {

public static void main(String[] args){

// here first I will declare an array like

int[] array = {1,2,3,4,5,6,7,8};

int i =0;

do{

System.out.println(array[i]);

i++;

}

while(i<array.length){

}

}

}

Connect with us:

Leave a comment

Your email address will not be published. Required fields are marked *

About Us

Providing expert blogs on web, SEO, tech, YouTube, and more, helping readers stay updated and grow in the digital world.

Email Us: contact@technicalspeaks.com

Contact: +91 7986794481

Top Categories​

Sign Up for Our Newsletter

Subscribe to our newsletter to get our newest articles instantly!