RE: quick java question

  • From: "Sina Bahram" <sbahram@xxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Thu, 29 Nov 2007 22:54:24 -0500

You put in a variable that is of type string. That is, if you have a string
which you think has an integer in it, such as "24 dogs", but I believe, from
later posts, that you're looking for a double, so I'll await the code.

Take care,
Sina 

-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Alex Parks
Sent: Thursday, November 29, 2007 8:55 AM
To: programmingblind@xxxxxxxxxxxxx
Subject: RE: quick java question

I am new to this language.  What do I put in place of "aString" 
and how do I use the exception in my if statement? Add a throwsException to
the end? Thanks.

Have a great day,
Alex

> ----- Original Message -----
>From: "Sina Bahram" <sbahram@xxxxxxxxx
>To: <programmingblind@xxxxxxxxxxxxx
>Date sent: Thu, 29 Nov 2007 07:07:27 -0500
>Subject: RE: quick java question

>If you're expecting an integer, then you can do

>Integer.parseInt(aString)

>That will throw a NumberFormatException if it isn't a number.

>Take care,
>Sina


>-----Original Message-----
>From: programmingblind-bounce@xxxxxxxxxxxxx
>[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Alex
Parks
>Sent: Thursday, November 29, 2007 12:51 AM
>To: programmingblind@xxxxxxxxxxxxx
>Subject: quick java question

>Hi all,
>Is there a quick way of determining if the user input is a
number? I need it
>to be a number; it throws an exception and exits the program if
it isn't.
>Maybe something like:
>if (input!=\int
>I have no idea about the syntax, but something along those lines
is what I
>am looking for.  Thanks for any help.

>Have a great day,
>Alex
>__________
>View the list's information and change your settings at 
>//www.freelists.org/list/programmingblind

>__________
>View the list's information and change your settings at 
>//www.freelists.org/list/programmingblind


__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: