我是新來的Java(與C#的經驗),如何從(靜態)類中的類創建新的類實例?
這就是我想做的事:
public final class MyClass
{
public class MyRelatedClass
{
...
}
}
public class OtherRandomClass
{
public void DoStuff()
{
MyRelatedClass data = new MyClass.MyRelatedClass();
}
}
這使得這個錯誤在Eclipse:
No enclosing instance of type BitmapEffects is accessible. Must qualify the allocation with an enclosing instance of type BitmapEffects (e.g. x.new A() where x is an instance of BitmapEffects).
這是可能在C#中使用靜態類,這裏應該怎麼做?
可能重複[Java - 沒有可以訪問Foo類型的封閉實例](http://stackoverflow.com/questions/9560600/java-no-enclosing-instance-of-type- foo-is-accessible) – fabian 2016-03-03 23:46:05