Linked Questions

211 questions linked to/from Java inner class and static nested class
389 votes
8 answers
299k views

What is the difference between static and non-static nested class?
8 votes
2 answers
61k views

I wrote this Java interface program in Eclipse, but there is a red line under MyTriangle tmp = new MyTriangle(); and when i run the program I get this error: No enclosing instance of type Question1 ...
user1896464's user avatar
18 votes
2 answers
12k views

Possible Duplicate: Java inner class and static nested class What are the uses of inner classes in Java? Are nested classes and inner classes the same?
billu's user avatar
  • 2,583
11 votes
4 answers
22k views

class Outer { class Inner { } } public class Demo { public static void main(String args[]) { Outer o = new Outer(); Outer.Inner inner = o.new Inner(); ...
Kalhan's user avatar
  • 21.9k
6 votes
1 answer
5k views

In package java.util.LinkedList, the Class Node defined as one static class, is it necessary? What is the goal? We can find source code from this page.
7 votes
3 answers
468 views

Constructors of non static member classes take an extra hidden parameter which is a reference to an instance of the immediately enclosing class. There is also a syntactic extension of 'new'. In the ...
1 vote
2 answers
2k views

I have a class structure like this: public class OuterClass { private static class InnerClass { public void someMethod() { OtherClass.otherMethod(<???>); } } ...
fiveclubs's user avatar
  • 2,439
4 votes
2 answers
2k views

I have a question about use of static inner class in the following code, adapted from Eckel's Thinking in Java 4th edition (page 625). The code uses a static inner class called Node. When you create ...
topsail's user avatar
  • 3,210
3 votes
1 answer
1k views

How can i create a instance of the following Class and access its methods. Example: public class A { public static class B { public static class C { public static class D { ...
Leonardo's user avatar
  • 471
6 votes
1 answer
436 views

Possible Duplicate: Java inner class and static nested class An instance of a static inner class cannot access the instance members of its enclosing class, whereas an instance of a non-static ...
1 vote
1 answer
863 views

Linklist have static class named as ENTRY private static class Entry<E> { E element; Entry<E> next; Entry<E> previous; Entry(E paramE, Entry<E> paramEntry1, Entry<E> ...
-1 votes
2 answers
1k views

In the following code why "Node head" is kept outside the inner class node? Since Node class is defined after writing "Node head", does it create any problem? why is the inner class defined as ...
3 votes
1 answer
306 views

I have a main class "m" and 2 inner classes called sub1,sub2, where sub2 is static class: public class m { String n="n"; static String s="s"; public class sub1 { public void fn(){System....
-3 votes
1 answer
1k views

I got an error when I try to create new class (that defined in the parent class) from a static method (in the parent class). error: non-static variable this cannot be referenced from a static ...
Mr Me's user avatar
  • 3
0 votes
1 answer
348 views

Now that I was looking into static inner class, I found that the way of object creation of static inner class and non-static inner class is different. But I don't understand why. For non-static inner ...

15 30 50 per page
1
2 3 4 5
...
15