Nested Classes pg. 276 Oct 5 A class can be declared inside another class. Just as a loop written inside another loop is called a nested loop, a class written inside another class is called a nested class. The nested class is a member of the class it is nested in, called the enclosing class, just like a variable or method. Just like any other class, a nested class produces a separate bytecode file. The name of the bytecode file is the name of the enclosing class followed by the $ character, followed by the name of the nested class. The bytecode file has an extension of .class. A class called Nested that is declared inisde a class called Enclosing will result in a compiled byttecode file called Enclsoing$Nested.class. Because it is a member of the enclosing class, a nested class can use the encloosing class's instance variables and methods, even if they are private. But the enclosing class can use data in the nestedd class only if the data is declared public. In general, we've always said that public data is a bad idea because it violates encapsulation. However, nested classes are the exception to the rule. It is reasonable to declare the data of a private nested class with public visibility because only the enclosing class can get to that data (despite its public declaration). A class hould be nested inside another class only if it makes sense for the enclosing class.