Answers for "for the jagged array J = {[1, 2], [3, 4, 5], [6]}, the method should create a dictionary with the following keys and values and prints the dictionary { 1: a list containing 1, 2 2: a list containing 3, 4, 5 3: a list containing 6 }"

0

how to get the length of a jagged array java

public static void main(String[] args) {

    int[][] foo = new int[][] {
        new int[] { 1, 2, 3 },
        new int[] { 1, 2, 3, 4},
    };

    System.out.println(foo.length); //2
    System.out.println(foo[0].length); //3
    System.out.println(foo[1].length); //4
}
Posted by: Guest on December-05-2020

Code answers related to "for the jagged array J = {[1, 2], [3, 4, 5], [6]}, the method should create a dictionary with the following keys and values and prints the dictionary { 1: a list containing 1, 2 2: a list containing 3, 4, 5 3: a list containing 6 }"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language