|
Object to int
|
|
02-28-2008, 02:40 PM
(This post was last modified: 02-28-2008 02:44 PM by moonlight.)
Post: #1
|
|||
|
|||
|
Object to int
How can I convert an object to int.
For eg: [java] Hashtable ht = new Hastable(); ht.put("one", "1"); int one= ht.get("one"); // How? [/java] |
|||
|
02-28-2008, 02:44 PM
Post: #2
|
|||
|
|||
|
RE: Object to int
Its easy.
[java] String value = (String) ht.get("one"); int one = Integer.parseInt(value); [/java] |
|||
|
02-28-2008, 02:58 PM
Post: #3
|
|||
|
|||
|
RE: Object to int
Please note that, parseInt method would throw a NumberFormatException if the given value is not a valid integer.
|
|||
|
« Next Oldest | Next Newest »
|

Search
Member List
Calendar
Help




