LogiQuest
Back to Generics
6

What is the output of the following program?

public class Main {
    public static void main(String[] args) {
        java.util.List<Integer> nums = java.util.List.of(1, 2, 3);
        int s = 0;
        for (int n : nums) s += n;
        System.out.println(s);
    }
}
Easy

Discussion (0)

  • No discussion yet. Ask a doubt or share a shortcut.

Log in to join the discussion.