Hi
Try this:
import java.io.*;
public class ReadKeyB {
public static void main (String args[]) {
try{
BufferedReader stdin =new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter a digit:");
int a = Integer.parseInt(stdin.readLine());
System.out.println(++a);
}catch(IOException e){System.out.println(e.getMessage());}
}
}
regards
ali farid
----- Original Message -----
From: Friendship <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, October 13, 2000 11:26 PM
Subject: Help, why wrong ?!
> Hi, guru,
>
> I am very new to java.
> I want read a int from keyboard and plus one, then
> display it.
> But why it doesn't work?
> Help me please!!
>
> Thanks & Have nice weekend!!
>
>
>
> import java.io.*;
> public class ReadKeyB {
>
> public static void main (String args[]) {
>
>
> DataInputStream in = new DataInputStream(System.in);
> int s ;
>
> try {
> s = in.readInt();
> int myint = intValueOf(s);
> myint++;
> System.out.println(myint);
> }
>
>
> catch (Exception e) {
> System.out.println("Error: " + e.toString());
> }
>
>
> }
>
> }
>
> __________________________________________________
> Do You Yahoo!?
> Get Yahoo! Mail - Free email you can access from anywhere!
> http://mail.yahoo.com/
>
>
> ----------------------------------------------------------------------
> To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]