-
How to take only integer input through keyboard in java
hello,
I know to take characters as input from keyboard in java. Can anybody
please let me know how to input integers from keyboard. For every input do
we have to create seperate objects of BufferedReader? Can we manipulate the
data also?
Thanks,
Jane.
-
Re: How to take only integer input through keyboard in java
Dear Jane,
It was nice to know ur question. I am ready to answer it to u only if u do
me a personel favor (u know what I mean).
Thanx,
Tim
"Jane" <jane_rocks2001@yahoo.com> wrote:
>
>hello,
> I know to take characters as input from keyboard in java. Can anybody
>please let me know how to input integers from keyboard. For every input
do
>we have to create seperate objects of BufferedReader? Can we manipulate
the
>data also?
>Thanks,
>Jane.
-
Re: How to take only integer input through keyboard in java
"Jane" <jane_rocks2001@yahoo.com> wrote:
>
>hello,
> I know to take characters as input from keyboard in java. Can anybody
>please let me know how to input integers from keyboard. For every input
do
>we have to create seperate objects of BufferedReader? Can we manipulate
the
>data also?
>Thanks,
>Jane.
-
Re: How to take only integer input through keyboard in java
"Jane" <jane_rocks2001@yahoo.com> wrote:
>
>hello,
> I know to take characters as input from keyboard in java. Can anybody
>please let me know how to input integers from keyboard. For every input
do
>we have to create seperate objects of BufferedReader? Can we manipulate
the
>data also?
>Thanks,
>Jane.
here is something that might help - just a code snipit;
// import the package you need
import javax.swing.JOptionPane;
// set up some variables
String keyBoardStuff;
int myInt=0;
// now get the integer
keyBoardStuff = JOptionPane.showInputDialog(
"Enter the integer: ");
// now convert from the string data to integer
myInt = Integer.parseInt(keyBoardStuff);
//now your integer data is in the variable myInt
Hope this helps;
Walker
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks