Menu
Question Index
...

What will be the output of the following program?

import java.util.*;

public class ArrayInitialize
{
    public static void main(String args[])
    {
        int array[] = new int[6];
        Arrays.fill(array, 100);

        for (int i = 0, n = array.length; i < n; i++)
        {
            System.out.print(array[i] + " ");
        }
        System.out.println();

        Arrays.fill(array, 3, 6, 50);
        for (int i = 0, n = array.length; i < n; i++)
        {
            System.out.print(array[i] + " ");
        }
    }
}


100 100 100 100 100 100
100 100 100 100 100 100
100 100 100 100 100 100
100 100 100 50 50 50
100 100 100 100 100 100
100 100 100 50 100 50
100 0 0 0 0 0
3 6 50 0 0 0
Compilation Error or Runtime Error

Doubts

Problems

Topic: Unknown

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App