Click here to Skip to main content
15,881,173 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
sir, i want to knew what is java use instead of C# Delegate . please provide with example.
Posted

1 solution

Does Java support delegates?

Not really.
You may be able to achieve the same effect by using reflection to get Method objects you can then invoke, and the other way is to create an interface with a single 'invoke' or 'execute' method, and then instantiate them to call the method your interested in (i.e. using an anonymous inner class).

See how a A Java Programmer Looks at C# Delegates[^]

Cheers,
Edo
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900