JAVA programming language allows to use one loop inside another loop. Following section shows few examples to illustrate the concept.
Syntax:
The syntax for a nested for loop statement in C is as follows:
for ( init; condition; increment ) { for ( init; condition; increment ) { statement(s); } statement(s); }
The syntax for a nested while loop statement in C programming language is as follows:
while(condition) { while(condition) { statement(s); } statement(s); }
The syntax for a nested do…while loop statement in C programming language is as follows:
do { statement(s); do { statement(s); }while( condition ); }while( condition );
A final note on loop nesting is that you can put any type of loop inside of any other type of loop. For example, a for loop can be inside a while loop or vice versa.
Original Code of Video:
package dynamicarray; import java.util.Scanner; public class DynamicArray { public static void main(String[] args) { String[] arrStudent = new String[5]; Scanner objscan = new Scanner(System.in); System.out.println("Enter Student Names: "); for (int i = 0; i < 5; i++) { // Loop for Set Values in Array arrStudent[i] = objscan.nextLine(); } System.out.println("Lists Of Student"); for (int j = 0; j < 5; j++) { //Loor for getting values in Array System.out.println("Student Name: "+ arrStudent[j]); } } }
Yes, I Will make it in just 1 week…
please make some tutorials on java GUI .