8 kyu

Weird Java Array

Description:

I want to create an array of Lists of Integers, like so:

import java.util.*;

class Codewarrior {
    public static List<Integer>[] arrayOfLists = new List<Integer>[] {
        Arrays.asList(1, 2, 3),
        Arrays.asList(4, 5, 6),
        Arrays.asList(7, 8, 9),
    };
}

However, this code does not compile :(

Can you fix the code ?

arrayOfLists should hold the 3 lists shown above, (1, 2, 3), (4, 5, 6), (7, 8, 9).

Debugging
Puzzles
Language Features

More By Author:

Check out these other kata created by trashy_incel

Stats:

CreatedMar 30, 2024
PublishedOct 4, 2024
Warriors Trained2234
Total Skips95
Total Code Submissions1909
Total Times Completed784
Java Completions784
Total Stars8
% of votes with a positive feedback rating76% of 66
Total "Very Satisfied" Votes40
Total "Somewhat Satisfied" Votes20
Total "Not Satisfied" Votes6
Total Rank Assessments6
Average Assessed Rank
8 kyu
Highest Assessed Rank
7 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • trashy_incel Avatar
  • dfhwze Avatar
Ad