繁体   English   中英

Java 代码“NumberFormat nf = NumberFormat.getInstance();”

[英]Java code “NumberFormat nf = NumberFormat.getInstance();”

以下有什么区别

NumberFormat nf = NumberFormat.getInstance();

NumberFormat nf = new NumberFormat()

为什么我们需要将 NumberFormat object 声明为第一个?

您不能使用new NumberFormat() 正如Javadoc注释的第一行,

NumberFormat是所有数字格式的抽象基础 class。

您不能直接实例化抽象 class,因此使用创建模式

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM