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.
拜托,你能解释一下为什么番石榴的创造者更喜欢将构造函数定义为私有的,并定义静态方法create()来创建对象吗?
create()
有效的 Java 项目 1:考虑静态工厂方法而不是构造函数。
静态工厂方法的一些优点包括: