代码如下,错误提示为SingletonTest类是公共的,请帮忙改正,谢谢!
class Singleton 
{
private static Singleton str; 
private Singleton(){};
public static Singleton getInstance() 
{
if (str == null)
str = new Singleton();
return str;
}
}
public class SingletonTest 
{
public static void main(String[] args) 
  {
  Singleton str1 = Singleton.getInstance();
  Singleton str2 = Singleton.getInstance();
  if (str1==str2)
  System.out.println("str1 is the same instance with str2");
  else
  System.out.println("str1 is not the same instance with str2");
  }
}