Results 1 to 3 of 3
Thread: using parse
- 01-15-2010, 12:54 AM #1
Member
- Join Date
- Dec 2009
- Posts
- 33
- Rep Power
- 0
- 01-15-2010, 01:14 AM #2
Integer.parseInt(String s)
It takes a String object as its parameter and makes it into an Integer object (Integer objects can be boxed into primitive data)
Example:
It converted the string "523" into an Integer object which autoboxed it to an int primitive data. This is what happens when you do not parse:Java Code:String num = "523"; int x = Integer.parseInt(num);
The same thing goes for double.Java Code:String num = "523"; int x = num; [COLOR="Red"]Exception in thread "main" java.lang.Error: Unresolved compilation problem: Type mismatch: cannot convert from String to int[/COLOR]
It converted the string "523.23" into an Double object which autoboxed it to an int primitive data.Java Code:String num = "523.23"; double x = Double.parseDouble(num);
Last edited by Lil_Aziz1; 01-15-2010 at 01:17 AM.
"Experience is what you get when you don't get what you want" (Dan Stanford)
"Rise and rise again until lambs become lions" (Robin Hood)
- 01-15-2010, 01:32 AM #3
Member
- Join Date
- Dec 2009
- Posts
- 33
- Rep Power
- 0
Similar Threads
-
Ugly XML to parse
By JohnST in forum New To JavaReplies: 2Last Post: 01-03-2010, 04:48 PM -
How to parse a .db file ?
By aminov in forum JDBCReplies: 0Last Post: 08-06-2009, 04:11 PM -
SAX Parse
By bluefloyd8 in forum New To JavaReplies: 1Last Post: 01-25-2008, 03:57 PM -
how to parse an xml file
By oregon in forum XMLReplies: 3Last Post: 08-01-2007, 04:53 PM -
How to parse in html
By paty in forum New To JavaReplies: 1Last Post: 07-24-2007, 12:29 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks