[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6 How To Ask Questions How To Answer Questions
shan raj wrote:The code is String temp = "526F75746572"; boolean ret; try { // try to parse the string to an integer, using 16 as radix int t = Integer.parseInt(temp, 16); // parsing succeeded, string is valid hex number ret = true; } catch (NumberFormatException e) { e.printStackTrace(); // parsing failed, string is not a valid hex number ret = false; } System.out.println("Is Hex String=" + ret); Expected output is "Is Hex String= true". But it says false and throws an NumberFormatException