About interface and inner-class.

old (HH)
本文发表在 rolia.net/zh 相约加拿大网上社区枫下论坛
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.
更多精彩文章及讨论,请光临枫下论坛. 网址: rolia.net/zh
2000-11-28 -04:00
This post has been archived. It cannot be replied.
Page address has been copied. To share, click to copy page address.
Share Online by QR Code

Back To Topic: Sos! help me from Polymorphism, Interface & Inner classes...

Back To Forum: HOME枫下论坛枫下论坛主坛工作学习IT技术讨论