Originally posted by Sanjul Jain:
thanks for your reply, but its not working. this is what i have done:
I need to print the value of s.
Regards,
Sanjul
You should post what happens when you run this example. I would guess that you are seeing the output when from the catch clause because an exception is thrown. The problem is that the String "1test" cannot be parsed to a short because it has non-numerical characters in it.
For future reference, it would be more helpful to do something like
in the catch clause. This will give you some helpful information when you an exception occurs unexpectedly in your program.
HTH
Layne