Menu
Topics Index
...
`

Inner Class2502


If you need explanation Read this topic

If you need Answer Take test on this topic

Inner Class2502
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();
        pv.new Print().value();
    }
    class Print {
        int x = 15;
        void value() {
            System.out.println(x + z);
        }
    }
}

A. (EMPTY)
B. 114.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 B z=99.0 and x+z will gives the double value

Posted by Bheema Reddy    2014-02-13 03:26:29


answer is c with in print class z is not defined.

Posted by Shiva Goud    2014-02-13 05:45:01


No winner for this dose. Correct option is B. Bheema Reddy already won the dose.

Posted by Merit Campus    2014-02-14 09:20:22


© meritcampus 2019

All Rights Reserved.

Open In App