Menu
Question Index
...

What will be the output of the following program?

public class AreYouReady {
    public static void main(String args[]) {
        String arg[] = {"1", "2"};
        toNull(arg);
        System.out.print(arg[0] + " ");
        System.out.print(arg[1]);
    }
    public static void toNull(String arg[]) {
        arg = null;
    }
}


null null
1 2
123
Some other output
Compilation Error or Runtime Error

Doubts

Problems

Topic: Java String Arrays - String Arrays In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App