Menu
Topics Index
...
`

Array declaration


If you need explanation Read this topic

If you need Answer Take test on this topic

Array declaration
What will be the output of the following program?
public class DemoOnArray {
    public static void main(String args[]) {
        int[][] firstArray, secondArray;
        firstArray = new int[1][1];
        secondArray = new int[2][2];
        firstArray[0][0] = '\n';
        secondArray[0][1] = 'a';
        System.out.print("Mod = " + secondArray[0][1] % firstArray[0][0]);
    }
}

A. Mod = 65
B. Mod = 10
C. Mod = 7
D. Compilation Error
E. Runtime Error
Topic: Java Multidimensional Array

If you need explanation Read this topic

If you need Answer Take test on this topic

User comments below. All of them might not be correct.

Ans is C...mod=7 ....as '\n' values is 10 and 'a' values is 97

Posted by Krishna Sai    2013-06-21 03:27:35


ans is c: ascii val of a i 97 n \n is 10 so 97%10 = 7

Posted by Sarika Vollala    2013-06-21 03:33:26


Congratulations Sarika Vollala. You are this dose winner. Please send us your mobile details and we will process the recharge asap.

Posted by Merit Campus    2013-06-21 08:13:56


recvd rc :)

Posted by Sarika Vollala    2013-06-28 12:43:40


© meritcampus 2019

All Rights Reserved.

Open In App