Passing implementation of Java interfaces

HiI have a static function which I want to be supplied with a another class. Now the passed class needs to be an implementation of that class. How can I make sure?ThanksSaaransh
[205 byte] By [Saaransha] at [2007-11-26 22:50:15]
# 1

> Hi

>

> I have a static function which I want to be supplied

> with a another class. Now the passed class needs to

> be an implementation of that class. How can I make

> sure?

>

> Thanks

>

> Saaransh

Huh?

Could you give an example?

prometheuzza at 2007-7-10 12:11:20 > top of Java-index,Java Essentials,Java Programming...
# 2
I don't think I really understand your question. Do you want all classesto implement a static method defined in the interface they implement?kind regards,Jos
JosAHa at 2007-7-10 12:11:20 > top of Java-index,Java Essentials,Java Programming...
# 3

an example:

Lets say I have an interface :

public interface foo

{

//some methods

}

Now thers a static function. Which I want should take in a parameter (an object) which has implemented the above interface.

How do i do this?

NOTE: I am making a framework API and thus the class making the object will not be known to me. It will be created by someone else and not me.

Thanks

Saaransha at 2007-7-10 12:11:20 > top of Java-index,Java Essentials,Java Programming...
# 4

public interface Foo { // <- should start with a capital!

//some methods

}

class YourClass {

public static void yourStaticMethod(Foo foo) {

// ...

}

}

prometheuzza at 2007-7-10 12:11:20 > top of Java-index,Java Essentials,Java Programming...