Menu
Question Index
...

What will be the output of the following program?

class Interfaces {
    public static void main(String[] args) {
        I i = new I() {
            public void print(char c, int i) {
                print(c);
                print((char) i);
            }
            void print(char c) { System.out.print(c + " "); }
        };
        i.print('A', 67);

        i = new I() {
            public void print(char c, int i) {
                print(c);
                print(i);
            }
            void print(int i) { System.out.print(i + " "); }
        };
        i.print('C', 72);
    }
}

interface I { void print(char c, int i); }


A C 67 72
65 67 67 72
65 67 C H
Compilation Error

Doubts

Problems

Topic: Unknown

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App