Link to home
Create AccountLog in
Avatar of gudii9
gudii9Flag for United States of America

asked on

exception handling

public class Try{
import java.io.*;
    public static void main(String argv[]){
        Try t = new Try();
        t.go();
    }//End of main
public void go(){
     try{
    InputStreamReader isr = new InputStreamReader(System.in);
    BufferedReader br = new BufferedReader(isr);
        br.readLine();
      } catch(Exception e){
     /*Not doing anything when exception occurs*/
     } //End of try
    System.out.println("Continuing");
   }//End of go
}

I was trying above example from link
http://www.jchq.net/certkey/0203certkey.htm
did not get any output.



I was trying to understand the output. Any links, ideas, resources,sample code highly appreciated. thanks in advance.
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Maybe you ddn't get any output, as it was waiting for your input from keyboard?

import java.io.*;

is normally on the very top not after class definition




When I tyoes ttt it responed Contniuing...

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Try{

    public static void main(String argv[]){
        Try t = new Try();
        t.go();
    }//End of main
public void go(){
     try{
    InputStreamReader isr = new InputStreamReader(System.in);
    BufferedReader br = new BufferedReader(isr);
        br.readLine();
      } catch(Exception e){
     /*Not doing anything when exception occurs*/
     } //End of try
    System.out.println("Continuing");
   }//End of go
}

Open in new window



ttt
Continuing

Open in new window

SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Avatar of gudii9

ASKER

>>>a. you typed ttt

just type ttt in eclipse console and then click enter right. please advise
> just type ttt in eclipse console and then click enter right. please advise

its irrelevant what you type, its just waiting for you to hit enter as I explained in my furst comment
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.