class Demo2
{
public static void main(String[] args)
{
Demo s=Demo.getDemo();
s.setMoneMin("zhangsan",7);
String b=s.getMoneMin();
System.out.println(b);
int a=s.getMone();
System.out.println(a);
}
}
class Demo
{
private static int min;
private static String mone;
private Demo(){}
private static Demo s=new Demo();
public static Demo getDemo()
{
return s;
}
public void setMoneMin(String mone,int min)//加上静态编译为什么this不能通过
{
this.mone=mone;
this.min=min;
}
public static String getMoneMin()
{
return mone;
}
public static int getMone()
{
return min;
}
|