lecture-35 - Packages and Member Access • A class has...

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

View Full Document Right Arrow Icon
Object Oriented Programming Java - Inheritance and Polymorphism Winter 2006 R.B. Lenin DA-IICT 67 Packages and Member Access • A class has only two possible access levels: default and public. • When a class is declared as public , it is accessible by any other code. • If a class has default access, it can be accessed only by other code within its same package.
Background image of page 1

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

View Full DocumentRight Arrow Icon
Object Oriented Programming Java - Inheritance and Polymorphism Winter 2006 R.B. Lenin DA-IICT 68 Packages and Member Access To include a class in a package: 1. Declare the class as public public class class-name { } This makes the class visible outside the package. 2. All the constructors of the class must be made public public contructor-name ( parameter-list ) { }
Background image of page 2
Object Oriented Programming Java - Inheritance and Polymorphism Winter 2006 R.B. Lenin DA-IICT 69 Java’s Class Library is Contained in Packages java.lang package is imported automatically into every java program. • One must explicitly important the other packages
Background image of page 3

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

View Full DocumentRight Arrow Icon
Object Oriented Programming Java - Inheritance and Polymorphism Winter 2006 R.B. Lenin DA-IICT 70 Interfaces • An interface is a class where no method can include a body. • An interface specifies what must be done, but not how. • An interface separates a class’s interface from its implementation by using the keyword interface .
Background image of page 4
Object Oriented Programming Java - Inheritance and Polymorphism Winter 2006 R.B. Lenin DA-IICT 71 Interfaces • Once an interface is defined, any number of classes can implement it. A class can implement any number of
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.

Page1 / 24

lecture-35 - Packages and Member Access • A class has...

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