[英]How to create an instance of a class nested within Static class which is in turn nested within Non-Static class?
下面如何创建Node的实例?
public class RemoveDups_1{
public static class LinkedList{
static int i = 5;
class Node{
}
}
}
我认为这是使用对象的一种非常奇怪的方式,但是如果您有兴趣创建Node类的实例,则可以通过以下方式实现它:
RemoveDups_1.LinkedList linkedList = new RemoveDups_1.LinkedList();
RemoveDups_1.LinkedList.Node node = linkedList.new Node();
资料来源: 有关嵌套类的Oracle文档
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.