About 316,000 results
Open links in new tab
  1. java - What are the purposes of inner classes - Stack Overflow

    Inner classes are best for the purpose of logically grouping classes that are used in one-place. For example, if you want to create class which is used by ONLY enclosing class, then it doesn't …

  2. Java inner class and static nested class - Stack Overflow

    Sep 16, 2008 · What is the main difference between an inner class and a static nested class in Java? Does design / implementation play a role in choosing one of these?

  3. java - What is the purpose of an inner class - Stack Overflow

    Nov 26, 2013 · An instance of an inner class can access members of an instance of the outer class, because an inner class is just another member of the outer class. And, inner classes …

  4. When to use inner classes in Java for helper classes

    From JAVA SE Docs Why Use Nested Classes? It is a way of logically grouping classes that are only used in one place: If a class is useful to only one other class, then it is logical to embed it …

  5. explain the way to access inner class in java? - Stack Overflow

    Apr 4, 2014 · That means that inner class will have access to instance variables in the enclosing class and would have to have a this reference to it. Think of it this way: non-static inner class …

  6. Java: Static vs inner class - Stack Overflow

    Mar 4, 2019 · An inner class, by definition, cannot be static, so I am going to recast your question as "What is the difference between static and non-static nested classes?" A non-static nested …

  7. How are anonymous inner classes used in Java? - Stack Overflow

    Dec 10, 2008 · An inner class is associated with an instance of the outer class and there are two special kinds: Local class and Anonymous class. An anonymous class enables us to declare …

  8. Builder Pattern in Effective Java - Stack Overflow

    8 You need to declare the Builder inner class as static. Consult some documentation for both non-static inner classes and static inner classes. Basically the non-static inner classes instances …

  9. Static nested class in Java, why? - Stack Overflow

    Oct 1, 2012 · I was looking at the Java code for LinkedList and noticed that it made use of a static nested class, Entry.

  10. Why can outer Java classes access inner class private members?

    I observed that Outer classes can access inner classes private instance variables. How is this possible? Here is a sample code demonstrating the same: class ABC{ class XYZ{ private int...