• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 294
  • Last Modified:

exception example

import java.io.*;
class Base{
public static void amethod()throws FileNotFoundException{}
}



public class ExcepDemo extends Base{
public static void main(String argv[]){
       ExcepDemo e = new ExcepDemo();
}

public static void amethod(int i)throws IOException{}
private boolean ExcepDemo(){
 try{
    DataInputStream din = new DataInputStream(System.in);
    System.out.println("Pausing");
    din.readChar();
    System.out.println("Continuing");
    this.amethod();
    return true;
    }catch(IOException ioe) {}
    finally{
    System.out.println("finally");
    }
    return false;
  }

}


I was trying above example from link
http://www.jchq.net/certkey/0203certkey.htm
did not understand output while running in eclipse ide.

I was trying to understand the output. Any links, ideas, resources,sample code highly appreciated. thanks in advance.
0
gudii9
Asked:
gudii9
1 Solution
 
objectsCommented:
its waiting for you input
you need to enter input into the eclipse console
0
 
for_yanCommented:
It prints "Pausing" and then blocks at
din.readChar();

until you provide input.
After it reads your input,
it prints "Continue"

0
 
msk_apkCommented:
you can not call this.amethod, as amethod is a static method. Also you are not calling the ExcepDemo() method, and you are just initializing ExcepDemo() constructor. You are doing nothing except initializing the constructor.
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
CEHJCommented:
>>I was trying to understand the output.

There isn't any output - for the reasons given by msk_apk
0
 
CEHJCommented:
gudii9, you accepted the wrong answer. The correct answer is given at http:#35237879
0
 
objectsCommented:
Would you like me to point you at a pile of other questions where the same occurs :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

Tackle projects and never again get stuck behind a technical roadblock.
Join Now