Menu
Question Index
...

What will be the output of the following program?

public class City {
    class Manhattan {
        void doStuff() throws Exception {
            System.out.println("X ");
        }
    }
    class TimesSquares extends Manhattan {
        void doStuff() throws Exception {    }
    }
    public static void main(String[] args) {
        new City().go();
    }
    void go() throws Exception {
        new TimesSquares().doStuff();
    }
}


X
X X
(No output)
Compilation Error
Runtime Error

Doubts

Problems

Topic: Java Throw Keyword - Java Throws Keyword

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App