Your preferences have been saved!
» This program demonstrates the use of static inner classes - public class StaticInnerClassTest {    public static void main(String[] args)    {       double[] d = new double[20];       for (int i = 0; i < d.length; i++)          d[i] = 100 * Math.random();       ArrayAlg.Pair p = ArrayAlg.minmax(d);       System.out.println("min = " + p.getFirst());       System.out.println("max = " + p.getSecond());... 17 Feb 12 » This program demonstrates the use of local inner classes - import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Date; import javax.swing.JOptionPane; import javax.swing.Timer; /**  * This program demonstrates the use of local inner classes.  * @version 1.00 2004-02-27  * @author Cay Horstmann... 17 Feb 12 » This program demonstrates the use of inner classes - import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Date; import javax.swing.JOptionPane; import javax.swing.Timer; /**  * This program demonstrates the use of inner classes.  * @version 1.10 2004-02-27  * @author Cay Horstmann... 17 Feb 12 » Accessing its enclosing instance from an inner class - public class Main {   private int number = 12;   public Main() {     InnerClass inner = new InnerClass();     inner.printNumber();   }   class InnerClass {     public void printNumber() {       System.out.println(Main.this.number);     }... 17 Feb 12 » Compiler will generate a synthetic constructor since SyntheticConstructor() is private -  */ public class SyntheticConstructor {   private SyntheticConstructor() {   }   class Inner {     // Compiler will generate a synthetic constructor since     // SyntheticConstructor() is private.     Inner() {       new SyntheticConstructor();     }... 17 Feb 12 » Nested Class Static - public class NestedClassStatic {   /** Just show that Nested Classes may be static */   static class V {   }   public static void main(String[] args) {     V v = new V();     System.out.println(v);     v = new V();     System.out.println(v);   }... 17 Feb 12 » With concrete or abstract classes, inner classes are the only - // : c08:MultiImplementation.java // With concrete or abstract classes, inner classes are the only way to produce the effect // of "multiple implementation inheritance." // From 'Thinking in Java, 3rd ed.' (c) Bruce Eckel 2002 // www.BruceEckel.com. See copyright notice in CopyRight.txt. class D { } abstract class E { } class Z extends D {... 17 Feb 12 » Holds a sequence of Objects - // : c08:LocalInnerClass.java // Holds a sequence of Objects. // From 'Thinking in Java, 3rd ed.' (c) Bruce Eckel 2002 // www.BruceEckel.com. See copyright notice in CopyRight.txt. interface Counter {   int next(); } public class LocalInnerClass {   private int count = 0;   Counter getCounter(final String name) {... 17 Feb 12 » Using inner classes for callbacks - interface Incrementable {   void increment(); } // Very simple to just implement the interface: class Callee1 implements Incrementable {   private int i = 0;   public void increment() {     i++;     System.out.println(i);   }... 17 Feb 12 » Proper inheritance of an inner class - class Egg2 {   protected class Yolk {     public Yolk() {       System.out.println("Egg2.Yolk()");     }     public void f() {       System.out.println("Egg2.Yolk.f()");     }   }   private Yolk y = new Yolk();... 17 Feb 12