new 是用来创建类对象的,你那是通过类中的方法获得对象 把new去掉就行了
public class test_001 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Sundae testSundae = Sundae.makeASundae();
testSundae.a();
}
}
class Sundae
{
private Sundae()
{
}
static Sundae makeASundae()
{
return new Sundae();
}
public void a(){
System.out.println("ok");
}
} |