使下面的类最终(添加公共最终类)对此类意图实现单例模式有任何实际影响吗?
package org.kodejava.example.pattern.factory;
public class Singleton {
private static Singleton instance = new Singleton();
private Singleton() {
}
public static synchronized Singleton getInstance() {
return instance;
}
public void doSomething() {
for (int i = 0; i < 10; i++) {
System.out.println("i = " + i);
}
}
@Override
protected Object clone() throws CloneNotSupportedException {
throw new CloneNotSupportedException("Clone is not allowed.");
}
}