public class Parcel6{
public class Content{
private String label="dfdsf";
public String getLabel( ){return label;}
}
public Content cont()
{
return new Content();
}
public static void main(String[] args)
{
Parcel6 p6=new Parcel6( );
Content c=p6.cont();
System.out.println(c.getLabel( ));
}
}
public class Content{
private String label="dfdsf";
public String getLabel( ){return label;}
}
public Content cont()
{
return new Content();
}
public static void main(String[] args)
{
Parcel6 p6=new Parcel6( );
Content c=p6.cont();
System.out.println(c.getLabel( ));
}
}
像你这样的用法,不能用匿名类,只能用内部类
申明内部类的时候最好加上 static 如public class Parce16 {
public static class Content {
......
}
}