Menu
Question Index
...

At lines will we get compilation error?

public class UniversalMusic {
    public static void main(String[] args) {
        /*A*/ int pop = 'P';
        /*B*/ char reggae = 'R';
        {
            /*C*/ System.out.println(pop + " " + reggae + " " + hiphop);
            /*D*/ float hiphop = 31.3f;
            /*E*/ System.out.println(pop + " " + reggae + " " + hiphop);
            /*F*/ double jazz = hiphop;
        }
        /*G*/ System.out.println(pop + " " + reggae + " " + hiphop);
        /*H*/ System.out.println(jazz);
        {
            /*I*/ short hiphop = 850062;
            /*J*/ System.out.println(pop + " " + reggae + " " + hiphop);
        }
        /*K*/ System.out.println(pop + " " + reggae + " " + hiphop);
    }
}


A, C, G, H, K
C, G, H, K
C, G, H, I, K
C, D, G, H, K

Doubts

Problems

Topic: Scope Of Variables In Nested/Multiple Blocks

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App