任何人都可以告诉我为什么我在以下代码上收到错误消息:
import java.text.DecimalFormat;
public class Labsheet {
public static void main(String args[])
{
double number = 1.0/3.0;
DecimalFormat number_format = new DecimalFormat(“#.##”);
System.out.println(number);
String formatted_string = number_format.format(number);
System.out.println(formatted_string);
}
}
Run Code Online (Sandbox Code Playgroud)
错误打开("#.##"); - 令牌上的语法错误,删除这些令牌.我不明白为什么这是一个错误.
我建议你换掉
“#.##”
Run Code Online (Sandbox Code Playgroud)
同
"#.##"
Run Code Online (Sandbox Code Playgroud)
作为“其是“和”其是”不能使用限定的字符串.
| 归档时间: |
|
| 查看次数: |
692 次 |
| 最近记录: |