Help on JAVA Programming Language? - buffer calculator phosphate
How can a string buffer, a float?
I'm writing a computer program that gives the user the numbers in a string buffer will be saved.
How can I float to a string buffer, or double, so you can add, subtract, multiply or divide.
Thank you all for your help in advance.
Buffer Calculator Phosphate Help On JAVA Programming Language?
11:26 PM
1 comments:
You can not convert directly StringBuffer swim or to double.
You need to convert to convert a StringBuffer String.Then can float or double as you want.
It can be shown as
StringBuffer s1 = new StringBuffer ( "31.0");
float f = Integer.parseInt (s1.toString ());
double d = Double.parseDouble (s1.toString ());
Note that there is a possibility NumberFormatException if the string is not a number that convertdir be able to swim.
Post a Comment