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.
LVL 7
gudii9Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mick BarryJava DeveloperCommented:
It wait for input from stdin.
You won't get any output until you hit enter
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
for_yanCommented:
Maybe you ddn't get any output, as it was waiting for your input from keyboard?
0
for_yanCommented:

import java.io.*;

is normally on the very top not after class definition
0
HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

for_yanCommented:




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

0
CEHJCommented:
It prints "Continuing" after

a. you typed ttt
b. you then hit enter

as

>>System.out.println("Continuing");

is the last statement in the method called (go)
0
gudii9Author Commented:
>>>a. you typed ttt

just type ttt in eclipse console and then click enter right. please advise
0
Mick BarryJava DeveloperCommented:
> 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
0
for_yanCommented:
Right.
It is btter to print a prompt like that
It would be much easier to interact with the program


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);
  System.out.println("Enter line:);
        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

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.