Conversion to String
Converting from primitive type to String can be done by using wrapper classes's static toString method.
Eg.
Case of ascii format to string:
You can convert an ASCII code to String using toString() method of Character wrapper class as shown below:
Conversion from string:
Then in this case use parseWrapper method. Example:
For float :
Converting from primitive type to String can be done by using wrapper classes's static toString method.
Eg.
double i = 42.0;
String str = Double.toString(i);
Case of ascii format to string:
You can convert an ASCII code to String using toString() method of Character wrapper class as shown below:
int i = 64;
String aChar = new Character((char)i).toString();
Conversion from string:
Then in this case use parseWrapper method. Example:
For float :
String s = "31.2";
float f = Float.parseFloat(s);
No comments:
Post a Comment