![]() |
|
#1
|
|||
|
|||
Convert string to integerhow do you convert string to integer?
|
|||
|
#2
|
|||
|
|||
Re: Convert string to integerQuote:
In java, there is a String class (giving rise to String objects). It's String, not string. Now, an int is a Java primitive (suitable for easy integer calculations), but an Integer is a class (giving rise to Integer objects---suitable for lots of things). Integer objects, are immutable. The value of an Integer object is determined when the object is created, and can not be changed (You can use the int value of an Integer in an expression to create a new Integer, but you can't change an Integer object itself.) So: Do you want to convert a Java String to an int primitive or to a Integer object? How are you going to use the result of the conversion? Some examples: JAVA Code:
Output: Code:
Regards, Dave |
Recent GIDBlog
Vista ?Widgets? on Windows XP by LocalTech
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The