What will happen when you attempt to compile and run the following code?
package net.dharmaraj;
import java.io.*;
abstract class ExBase
{
abstract public void martley();
}
public class MyEx extends ExBase
{
public void martley()
{
}
public static void main(String argv[])
{
DataInputStream fi = new DataInputStream(System.in);
try
{
fi.readChar();
}
catch (IOException e)
{
System.exit(0);
}
finally
{
System.out.println("Doing finally");
}
}
}
1) Compile time error
2) It will run, wait for a key press and then exit
3) It will run, wait for a keypress, print "Doing finally" then exit
4) At run and immediately exit
No comments:
Post a Comment