Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

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();
        }

    }
}
 
PREVIOUS NEXT
Tagged: #nested #loop #java
ADD COMMENT
Topic
Name
4+6 =