Java Programming and Technical Programming

_____ exceptions are automatically propagated. To propogate _____ exceptions, the method should explicitly throw the exception using the throws keyword.

A. checked, unchecked
B. unchecked, checked

Read Solution (Total 2)

Java Other Question

Predict the output

import java.io.IOException;

public class Exception1{

public static void main(String[] args)

{

try

{

throw new IOException();

}

catch(IOException | Exception ex)

{

System.out.println(ex + " handled ");

}

}

}

A. program won't compile
B. runtime exception
C. program will compile
D. None of the above
class Mammal
{
String name= "Dog";
String makeNoise()
{
return "Bow Wow";
}
}

class Cat extends Mammal
{
String name="Cat";
String makeNoise()
{
return "Meow";
}
}

public class Main
{
void go()
{
Mammal m = new Cat();
System.out.println(m.name + m.makeNoise());
}
public static void main (String[] args)
{
new Main().go();
}
}

What is the output of the above program?

A. CatMeow
B. DogBow Wow
C. DogMeow
D. CatBow Wow