Welcome Guest | Sign in | Register
Flow Control - Discussion Page For Q.2801 | Java Programming Questions and Answers | Java Programming Free Online-Tests | LucentBlackBoard | LucentBlackBoard.com

Home > Java Programming > Flow Control > Questions and Answers

Q: Find the Output Of the following Code:

1. import java.io.*;
2. public class Example4 {
3. public static void main(String[] args) {
4. Example4 e4 = new Example4();
5. try{
6. e4.check();}
7. catch(IOException e){}}
8. void check() throws IOException{
9. System.out.println("Inside check() method of Class ");
10. throw new IOException();}}
11. class Subexample4 extends Example4 {
12. void check() {
13. System.out.println("Inside check() Method of Subclass");
14. }}

What will be the output of the following code snippet :
A. Above program will throw exception & will not run. B. Inside check() method of class
C. Inside check() method of Subclass D. Inside check() method of class
Inside check() method of Subclass.

Answer and Explanation

Answer:Inside check() method of class

Explanation:
Because the "e4"object is the member of the main class, therefore it can call only the methods of the main class. 

Comment on this Question

Name:

Loading...




Partner Sites
LucentBlackBoard.com                  SoftLucent.com                  LucentJobs.com
All rights reserved © 2012-2015 SoftLucent.