Menu
Question Index
...

What will be the output of the following program?

public class ArrayOutput
{
    public static void main(String s[])
    {
        int student_marks[] = new int[5];
        student_marks[2] = 25;
        System.out.println("Third Element = " + student_marks[2]);
        System.out.println("Fourth Element = " + student_marks[3]);
        student_marks[5] = 50;
        System.out.println("Fifth Element = " + student_marks[5]);
    }
}


Third Element = 25
Fourth Element = 0
Fifth Element = null
Third Element = 25
Fourth Element = 0
Fifth Element = 50
Third Element = 25
Fourth Element = 0
Fifth Element = 0
Third Element = 25
Fourth Element = 0
Fifth Element = {EMPTY}
Compilation Error or Runtime Error

Doubts

Problems

Topic: Arraylist Access Using Index

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App