Содержание
- 2. Nested Classes (1 of 2) A nested class is a class defined within another class: class
- 3. Nested Classes (2 of 2) A nested class is a member of its enclosing class Non-static
- 4. Why Use Nested Classes? It is a way of logically grouping classes that are only used
- 5. Static Nested Classes (1 of 2) A static nested class is associated with its outer class
- 6. Static Nested Classes (2 of 2) Static nested classes are accessed using the enclosing class name:
- 7. Inner Classes (1 of 2) An inner class has direct access to that object's methods and
- 8. Inner Classes (2 of 2) To instantiate an inner class, you must first instantiate the outer
- 9. Local Inner Classes Inner classes can be created inside code blocks, typically inside the body of
- 10. Anonymous Classes Anonymous classes combine the process of definition and instantiation into a single step As
- 11. Anonymous Class Example I new Thread(new Runnable() { public void run() { ... } }).start(); *
- 12. Anonymous Class Example II JFrame frame = new JFrame("AnonimDemo2"); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e)
- 13. Anonymous Classes Use For creating objects on the fly in contexts such as: the value in
- 15. Скачать презентацию