Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

nested for each loop java


public class Sample {
    public static void main(String[] args) {

        String names[][] = {
                { "Jasmine", "jasmine123" },
                { "lyka", "lyka123" },
                { "marbie", "marbie123" }
        };
        for (String name[] : names) {
            for (String info : name) {
                System.out.println(info);
            }
            System.out.println();
        }

    }

}
Comment

java nested loop

// This nested for loop will print 5 rows of 20 asterisks each

for(int i = 0; i < 5; i++) {
  for(int j = 0; j < 20; j++) {
    System.out.print("*");
  }
  System.out.println();
}
Comment

java nested for loop

for (int i = 0; i < 10; i++) {
	for (int j = 0; j < 10; j++) {
		System.out.println("*");
    }
  System.out.println("");
}
Comment

nested for loop java


public class Sample {
    public static void main(String[] args) {

        for (int x = 0; x < 5; x++) {
            for (int y = 0; y < 5; y++) {
                System.out.println(y);
            }
            System.out.println();
        }
    }
}
Comment

nested for loop java


public class Sample {
    public static void main(String[] args) {

        String names[][] = {
                { "Jasmine", "jasmine123" },
                { "lyka", "lyka123" },
                { "marbie", "marbie123" }
        };
        for (int row = 0; row < names.length; row++) {
            for (int col = 0; col < names[row].length; col++) {
                System.out.println(row + ":" + col);
            }
            System.out.println();
        }

    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: Linked list implementation in Java source code 
Java :: add integers java 
Java :: compare two strings java 
Java :: java calling a method 
Java :: log4j2.properties file need to save in spring boot application 
Java :: java reverse array 
Java :: first and last element of array java 
Java :: how to create a derived class in Java 
Java :: connection data base java code 
Java :: spring jpa query with union all 
Java :: jlabel icon size 
Java :: android disable inputs while loading 
Java :: selenium firefox to foreground -python java 
Sql :: sql disable safe mode 
Sql :: count of tables in database mysql 
Sql :: service postgres status 
Sql :: alter table add column boolean 
Sql :: how to get non integer value in sql 
Sql :: oracle show grants on table 
Sql :: mysql show databases 
Sql :: alter table column size oracle 
Sql :: mysql command line xampp ubuntu 
Sql :: date today snowflake 
Sql :: get table columns from sql 
Sql :: Row Number is sql server 
Sql :: sql query to find duplicates in column 
Sql :: sql getdate date only 
Sql :: postgresql concatenate multiple rows in group by 
Sql :: find last instance of character in string mysql 
Sql :: postgresql change column to not null 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =