Aug 25

The Integer class contains a number of (static) methods for converting to/from various formats. To convert to an integer use static method Integer.parseInt()

String s = "123";
try
{
   int i = Integer.parseInt(s);
}
catch (NumberFormatException ex)
{
   // s is not an integer
}

written by objects \\ tags: , , ,


Leave a Reply

You must be logged in to post a comment.