Menu
Topics Index
...
`

Inner Class2504


If you need explanation Read this topic

If you need Answer Take test on this topic

Inner Class2504
What will be the output of the following program?
public class PrintZValue {
    double z = 'c';
    public static void main(String[] args) {
        PrintZValue pv = new PrintZValue();
        Print print = new Print();
        pv.print.value();
    }
    public class Print {
        int x = 15;
        void value() {
            System.out.print("Output ");
            System.out.print(x + z);
        }
    }
}

A. Output 114.0
B. Output 1599.0
C. Compilation Error
D. Runtime Error
Topic: Advanced Java Programming Concepts

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...as we cannot access Print instance using printzvalue class instance...

Posted by Santosh Munugota    2014-02-06 08:59:05


Compile time error...

Posted by Ashish Bhavsar    2014-02-06 09:29:10


Congratulations Santosh Munugota. You are this dose winner. We will send you the link using which you can claim your recharge.

Posted by Merit Campus    2014-02-07 09:05:11


© meritcampus 2019

All Rights Reserved.

Open In App