Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个程序,我尝试更改我的双精度数的小数位数。我有一本书告诉我做 import java.text.* 然后这个:
NumberFormat nf = new NumberFormat.getNumberInstance(); nf.setMaximumFractionDigits(1);
但在第一行我收到错误“NumberFormat.getNumberInstance() 无法解析为类型”。为什么我做不到?
你的问题在这里:NumberFormat nf = new NumberFormat.getNumberInstance();。您需要new从那里删除关键字才能得到这个:NumberFormat nf = NumberFormat.getNumberInstance();。您正在访问一个static方法,您不需要new这里。
NumberFormat nf = new NumberFormat.getNumberInstance();
new
NumberFormat nf = NumberFormat.getNumberInstance();
static
编辑4:
我不知道为什么,但是我在下面使用的结构不起作用。我不得不修改我在 java2s 网站上找到的一个文件,它叫做 TableFromDatabase,然后将 JTextFields 设为公共静态,然后在 FrmMovimento 等中实例化 TableFromDatabase 类:
TableFromDa
2 java - 使用 simpledateformatter 进行日期解析
1 ios - iOS 编程是否会使用 Clang 和 llvm 进行虚拟化?
Reference php × 1429865 c/c++ × 756500 nginx × 49975 mongodb × 159057 mybatis × 3233 anaconda × 13410 pycharm × 14671 python × 1902243 vscode × 56040 docker × 110988 github × 49000 flask × 49129 ffmpeg × 24037 jmeter × 16910 matplotlib × 63493 bootstrap × 54641