View Single Post
Old 07-07-2012, 10:35 PM   PM User | #9
sorlaker
Regular Coder

 
Join Date: Dec 2009
Posts: 166
Thanks: 23
Thanked 1 Time in 1 Post
sorlaker has a little shameless behaviour in the past
How can i use it with lots of lines?

like :

Code:
while(e.hasNext()){
    int i = 0;
    try{
        i = Integer.parseInt(e.nextLine());
        System.out.println("Your input is a number : "+i);
    }catch (Exception ex){
        String a = e.nextLine();
        System.out.println("Your input is a text : "+a);
    }
}
Terminal :
OBVIOUS OUTPUT I KNOW XP
Code:
90
Your input is a number : 90
omg
omgogmgomgomgomg
Your input is a text : omgogmgomgomgomg
I want something like this :

Code:
90
Your input is a number : 90
omg
Your input is a text : omg
....

how can i do that?

Last edited by sorlaker; 07-07-2012 at 10:45 PM..
sorlaker is offline   Reply With Quote