Nested Inner Class « Class « Java Articles

Java Articles
1. Build Deploy
2. Class
3. Core Library
4. Data Types
5. Database JDBC
6. Design
7. Development
8. File Input Output
9. Graphics Desktop
10. J2EE Enterprise
11. J2ME Wireless
12. JVM
13. Language
14. Library Product
15. Network
16. Security
17. SOA Web Services
18. Test
19. Web Development
20. XML
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Products
Java by API
Photoshop Tutorial
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Articles » Class » Nested Inner Class 
1. Classes within classes
"Source code clarity improves with class nesting because you declare a class closer to those objects it must manipulate and allow that class's methods to directly access object fields and call object methods -- even private fields and methods -- of enclosing classes. To understand that benefit, consider a scenario in which a program must iterate over an array of Job objects that exist within an Employee object:"

2. Java Tip 75: Use nested classes for better organization
"Because of this, inner class objects require an object of the enclosing class, while nested class objects do not. Nested classes, therefore, behave just like top-level classes, using the enclosing class to provide a package-like organization. In addition, nested classes have access to all members of the enclosing class."

3. Nested Classes, Part 2
"Editor's note: Robert Simmons continues his efforts to clarify confusion over the use of nested classes in Java in this week's installment, excerpted from Chapter 6 ("Nested Classes") of Hardcore Java. Robert discusses the somewhat troublesome limited-scope inner classes; one specific type within this category, known as anonymous classes; and the various problems programmers can encounter with limited-scope classes."

4. Nested Classes, Part 1
"Author's note: The use of nested classes in Java is a constant source of confusion for many programmers. Yet understanding nested classes is critical to such things as the proper implementation of UML composition relationships in Java. In addition, such understanding will help the professional developer unravel spaghetti code put out by other developers."

5. Nested Classes, Part 3
"This code declares a public static nested class. This nested class can access the various static members of the enclosing class. However, unlike inner classes, it cannot access any instance variables in the enclosing class. This is an important difference between static nested classes and inner classes. Formally, it can be said that an inner class is instance-scoped and a static nested class is class-scoped. The class scope of a static nested class makes it easier to use:"

6. Some Insight Into Inner Classes in Java, Part 1
"Inner classes are essentially classes defined inside other classes and act like members of the enclosing class. There are two varieties of inner classes, static inner classes and non-static ones. The difference is suggested in the name itself, the static inner classes are associated with the enclosing class (as any other static member) while inner classes are associated with the "object" of the enclosing class. We shall explore the difference further later. Inner classes are a phenomenon of the compiler. It converts the inner classes as plain classfiles with some strange class names, the virtual machine does not distinguish between regular class's and inner class's class files."

7. SJCP Exam Preparation: Top-level and Inner Classes
"One of the Sun Certified Java Programmer (SJCP) Exam's objectives is to declare and construct any kind of class, including top-level, nested top-level, and inner classes. You are obviously going to be asked questions about this in the exam. I will elaborate on this exam objective in detail, with the support of examples and code snippets. You will then have a correct understanding of top-level, nested top-level, and inner class concepts and will be able to solve every question that is related to this exam objective."

8. Some Insight Into Inner Classes in Java, Part 2
"In the first half of this article, we began examining the benefits of inner classes, such as adding a "facet" to the behavior of an enclosing class to enrich its interactions. Then we touched upon their ability to act as access control points, where the inner class can be used to provide controlled access to some resource or to define isolated callbacks. Here, we'll follow up on this point and move on to discuss callbacks "on the fly" and static inner classes."

w___w_w__.ja__v_a___2___s___.c_o_m__ | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.