Question from the Java - Fundamentals test

How to print an array in Java

Medium

Given this code :

public class QuestionJava {
    public static void main(String[] args) {
        Integer[] tab = new Integer[3];
        tab[0] = 2;
        tab[1] = 5;
        tab[2] = 8;
        System.out.println(tab); // line 7
    }
}

What should we modify at line 7 to display corretly the array and its elements?

Author: PierreStatus: PublishedQuestion passed 1606 times
Edit
3
Community Evaluations
developer avatar
Alwyn
26/01/2024
Il faudrait afficher les numéros de ligne pour que ça soit plus pratique ^^
developer avatar
Steve Merlvyn
13/04/2024
Oui effectivement je suis d'accord !