About interface and inner-class.

old (HH)
<本文发表于: 相约加拿大:枫下论坛 www.rolia.net/f >
Let me try to explain in English.
I think you have read a lot about Java. Here I try to explain what you concerned in my way of understanding things. Hope not to make any confuse.

Interface is a definition about how a entity to communicate with other entities. It does not matter how the interface is immplemented.

For example of PCI slot in personal computer: it is a interface between the PCI cards and the mainboard. But different mainboards and different PCI cards have their own immplementations. If the immplementations conform the interface definition they will work well.

In Java the Interface is a declaration of a set of methods and some named constants in a class, their immplementations are not defined or specified. Just like a PCI slot in personal computer.
You can immplement an interface (call it PCISlot) as following:

class PCICard implements PCISlot {


class MainBoard implements PCISlot {

As far as I know, inner-class was introduced from Java JDK 1.1and later and just is a nonstatic class defined within another class

class OutClass {
class InnerClass {

Please pay some attentions to some access limitations on the inner class.

I am not sure if these make things clear. Hope not to make you confuse again.
<本文发表于: 相约加拿大:枫下论坛 www.rolia.net/f >

2000-11-28 -04:00

回到话题: Sos! help me from Polymorphism, Interface & Inner classes...

回到论坛: HOME枫下论坛枫下论坛主坛工作学习IT技术讨论