Results 1 to 2 of 2
Thread: Question about interfaces!
- 07-15-2012, 02:44 AM #1
Member
- Join Date
- Jul 2012
- Posts
- 5
- Rep Power
- 0
Question about interfaces!
Well, I didn't get something about interfaces. I know interfaces have just abstract methods so they should be implemented by a class. I was working with the javax.sound.midi.* package, so i saw that there was an interface called Sequencer, and in the example I saw, it called the method open() of the Sequencer interface. But how can i call the method open() if this method isn't implemented yet. At least I didn't found any class that implements the Sequencer. So where's the implementation f these methods. I'm totally new to Java and I didnt get it, is there something I should know about it that I still don't know? Thanks a lot and sorry my bad english!
- 07-15-2012, 03:38 AM #2
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,716
- Rep Power
- 19
Re: Question about interfaces!
Use the getSequencer() method of MidiSystem as described in "Obtaining a Sequencer" in the "Using Sequencer Methods" page of Oracle's Tutorial.
getSequencer() returns some class or other that implements the Sequencer interface. Your code doesn't know or care what concrete class it is: it just uses the interface methods.
Similar Threads
-
Have a question about Interfaces abstract classes and arraylists...
By Nyxeka in forum New To JavaReplies: 2Last Post: 03-20-2012, 11:55 PM -
A question on Interfaces.
By fatabass in forum New To JavaReplies: 4Last Post: 01-28-2012, 01:00 AM -
Question on interfaces
By fatabass in forum New To JavaReplies: 16Last Post: 01-23-2012, 03:33 PM -
Interfaces
By blug in forum New To JavaReplies: 1Last Post: 11-19-2010, 05:46 PM
Bookmarks