简单问题!!浮点数如何转化为字符串

SJLPY 2004-09-16 01:33:27
我用
String str=new String(float);转化不知为何报错!正确方法是什么。
...全文
135 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
sclarkca810619 2004-09-16
  • 打赏
  • 举报
回复
these are two basic methods to convert the types, first, maybe you want to convert the input string to number for use, second, maybe you want to convert the input string by some special encode methods, so just choice the method by your need!
diaopeng 2004-09-16
  • 打赏
  • 举报
回复
Float.toString(f)
wangwei8117 2004-09-16
  • 打赏
  • 举报
回复
Float.toString(f);方法多呢,要是想输出的话不要转换的,直接加在输出字符后面就可以自动转换输出了,如:System.out.println("ad"+f);这样就可以了!
liujs1026 2004-09-16
  • 打赏
  • 举报
回复
String str = String.valueOf(float)
kingfish 2004-09-16
  • 打赏
  • 举报
回复

Float.toString(f)
or
String s=""+f;
wandou999 2004-09-16
  • 打赏
  • 举报
回复
c.toString();

81,122

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧