basically an interface defines a way of interacting with another object it sets out what methods are available for another class to use without saying how they are to be implemented. A good example of interfaces in use is the collections api (java.util.*), some people don't teach this which is really stupid so if whoever is teaching you java doesn't introduce you to collections find someone who will (a basic tutorial is at
anyway there are whole host of collections; HashSet, LinkedList, ArrayList.... they all implement methods like add(), remove(), contains(), ... but they all do it differently but as programmers we don't, and shouldn't, care. All we care about is that they do implement these methods and we can use them the same way no matter what sort of collection it is.
An inner class is a class concealed within another this is usually done when you start getting into event binding with gui stuff, although you can usually do it anywhere, for instance;
[tt]
this.addWindowListener(new WindowAdapter(){
[tab]public void windowClosing(Window event e){
[tab][tab]System.exit(0);
[tab]}
});
[/tt]
the syntax for this is a bit confusing it took me three years to get used to so for now just copy and paste stuff like this out of examples.
this is an "anonymous inner class" and will result in a class file called
classname$number.class only the outer class
classname.class will be able to access this class for the purpose of a callback for the window closing event. I haven't actually had to use anyother sort of inner class but i gather you can do it like:
[tt]
public class Outer{
[tab]//outer stuff
[tab]class Inner{
[tab][tab]//inner stuff
[tab]}
}
[/tt]
I'm sure its useful in some cases
hope this clears things up X-)
[sig]<p>Chris Packham<br><a href=mailto:kriz@i4free.co.nz>kriz@i4free.co.nz</a><br><a href= > </a><br>A thousand mokeys at a thousand machines, it happened, it got called the internet.[/sig]