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;
        student_marks[2] = 35;
        student_marks[3] = 45;
        student_marks[4] = 55;
        System.out.println("Third Element = " + student_marks[2]);
        System.out.println("Fourth Element = " + student_marks[3]);
        System.out.println("Fifth Element = " + student_marks[4]);
    }
}


Third Element = 25
Fourth Element = 45
Fifth Element = 55
Third Element = 35
Fourth Element = 45
Fifth Element = 55
Compilation Error
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