Menu
Question Index
...

What will be the output of the following program? Assume that if we run XXL class.

package com.mc.size;
import com.mc.group.M;
import com.mc.type.XL;
public class XXL {
    public static void main(String[] args) {
        for (int i = 0; i < 3; i++) {
            System.out.print(XL.str + new XL().srt + XL.rts + new XL().rst);
            new M();
            System.out.print(M.a[i]);
        }
    }
}
package com.mc.type;
public class XL {
    public static String str = "~";
    public String srt = "&";
    public static String rts = "#";
    public String rst = "@";
    public static void main(String[] args) {
    }
}
package com.mc.group;
public class M {
    static public char[] a = {'a', 'b', 'c'};
    public static void main(String[] args) {
        System.out.print(a);
    }
}


~&#@a~&#@b~&#@c
~&#@abca~&#@abcb~&#@abcc
Some other output
Compilation Error
Runtime Error

Doubts

Problems

Topic: Java Package

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App