Trail: Learning the Java Language
Lesson: Classes and Objects
Questions and Exercises
Home Page > Learning the Java Language > Classes and Objects

Questions and Exercises: Nested Classes

Questions

  1. The program Problem.java doesn't compile. What do you need to do to make it compile? Why?

  2. Use the Java API documentation for the Box class (in the javax.swing package) to help you answer the following questions.

    1. What static nested class does Box define?

    2. What inner class does Box define?

    3. What is the superclass of Box's inner class?

    4. Which of Box's nested classes can you use from any class?

    5. How do you create an instance of Box's Filler class?

Exercises

  1. Get the file Class1.java. Compile and run Class1. What is the output?

Check your answers.


Problems with the examples? Try Compiling and Running the Examples: FAQs.
Complaints? Compliments? Suggestions? Give us your feedback.

Previous page: Summary of Nested Classes
Next page: Enum Types



Spec-Zone.ru - all specs in one place