bijayanib
05-24-2010, 02:13 AM
Hi All,
I came across a Java tips and would like to share with you. The tips is regarding "Converting datatype in Java". here is the few detail about the tips:
There are times while coding when we need to convert an entity of one datatype to another. For instance, in the following example, assigning an integer value to a string would throw exception, so what we would do instead is convert the integer into a string value.
integer to String :
int i = 42;
String str = Integer.toString(i);
or
String str = "" + i;
Hope you find it useful and of assistance.
Regards,
Bijayani
I came across a Java tips and would like to share with you. The tips is regarding "Converting datatype in Java". here is the few detail about the tips:
There are times while coding when we need to convert an entity of one datatype to another. For instance, in the following example, assigning an integer value to a string would throw exception, so what we would do instead is convert the integer into a string value.
integer to String :
int i = 42;
String str = Integer.toString(i);
or
String str = "" + i;
Hope you find it useful and of assistance.
Regards,
Bijayani