lecture20

lecture20 - PIC 20A Lecture 20: Inner Classes Inner Class a...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
PIC 20A Lecture 20: Inner Classes
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Inner Class • a class defined inside another class • can be defined inside a method or not • can have either public , protected , private , or package access (works in the same sense as for an outer class member) • the compiler turns an inner class into a regular bytecode file (ending in .class ) eg inner class QuickPanel has bytecode file ExampleMenuApplet$QuickPanel.class
Background image of page 2
Inner Classes Definitions • can be complete (with a class name) •o r anonymous inner class definitions (classes without a name)
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
What can Inner Classes access? • all the instance variables and methods of the outer class directly • If defined inside the method of a class, it also has access to the final local variables of the method in which it is defined
Background image of page 4
• since it has no name, one object of the anonymous inner class must be created at the point where the class is defined in the program. • when it implements an interface, it must
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/12/2010 for the course PIC PIC 20A taught by Professor Keithouellette during the Spring '09 term at UCLA.

Page1 / 12

lecture20 - PIC 20A Lecture 20: Inner Classes Inner Class a...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online