Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.42!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Nigel Wade Newsgroups: comp.lang.java.help Subject: Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? Date: Thu, 07 Jul 2011 09:43:00 +0100 Lines: 27 Message-ID: <97l9slF64tU1@mid.individual.net> References: <521s0711i3d7bsc8620isi0oiidl91kujq@4ax.com> <7an6179km7upsvba40ebe98gmfedg2414k@4ax.com> <97imauF3tbU1@mid.individual.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: individual.net Wu+Kq0NFIQI42Ufplj5fjgwLRxWDDZ3Gvtrc8GGGnUESQEtdOD Cancel-Lock: sha1:qEUZxYYh7vIMl2hXu7UNHexOKXE= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.1.16) Gecko/20101125 SUSE/3.0.11 Thunderbird/3.0.11 In-Reply-To: Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.help:836 On 06/07/11 19:13, Thee Chicago Wolf [MVP] wrote: > As I told one of the other posters, Maybe I just misunderstood my prof > when he said it's all strings. I am still learning this stuff. > > The assignment didn't say it couldn't be used. But, it wasn't > something I'd known about anyway so it might not have helped this time > around. > Your viewpoint may depend on your perspective. When dealing specifically with input from character streams, all input is indeed strings (or streams of char). Until you parse the stream and interpret it is a string. At some point you will probably want to interpret parts of the string as different types, such as integers, floats, names, keywords, etc. At that point the string takes on a structure determined by the parser which interprets the content of the string. The reason that I alluded to Python above is that I have a recollection that that is how Python handles "objects", as a string representation until required to do something different (such as arithmetic). I only dabbled with Python, and that was a few years ago, so my recollection may be wrong. -- Nigel Wade