Menu
Topics Index
...
`

Creating Try & Catch Block


If you need explanation Read this topic

If you need Answer Take test on this topic

Creating Try & Catch Block
What is the output of the following program?
public class ErrorTest {
    public static void main(String[] args) {
        float f = 90;
        char i = 0;
        try {
            float d = f / i;
            System.out.println(d);
        } catch (Exception e) {
            System.out.println("Exception");
        }
    }
}

A. Exception
B. Infinity
C. Compilation Error
D. Throws NumberFormatException
E. Throws some other Exception
Topic: Try Catch Block In Java

If you need explanation Read this topic

If you need Answer Take test on this topic

User comments below. All of them might not be correct.

B is the correct answer because in the Float class there is a constant by name Infinity hence it prints Infinity

Posted by Ram Reddy Bitla    2013-08-14 03:42:23


Option:A is correct because float doesn' t contain infinity....so it throws an exception....since already they want to print only exception.....what ever in print function it prints that...

Posted by Racha Rajesh    2013-08-14 05:11:42


d because the programing numbers or not excepted

Posted by Aruna Dantu    2013-08-14 06:22:30


anser  c

Posted by Srivani Narahari    2013-08-14 07:42:11


answer is E it throws arithmetic exception

Posted by Aparna Kanjarla    2013-08-14 15:54:07


Congratulations Ram Reddy Bitla. You are this dose winner. Please send us your mobile details and we will process the recharge asap.

Posted by Merit Campus    2013-08-15 03:33:46


my details are  8125262251 docomo

Posted by Ram Reddy Bitla    2013-08-15 03:43:30


© meritcampus 2019

All Rights Reserved.

Open In App