Compiler Error J0272

A multicast delegate cannot return a value

The compiler detected a return type other than void for a multicast delegate declaration. Although delegates can return a value other than void, multicast delegates cannot return a value other than void. Ensure that the multicast delegate declaration specified by the error returns void and compile again.

The following example illustrates this error:

multicast delegate int SimpleDelegate(int x, int y);
//error: cannot declare multicast delegate with non-void return type
public class Simple{
   public int method1(int x, int y){
      //Do something here
   }
   
   public static void main (String args[]){
      Simple smp = new Simple;
      SimpleDelegate sd = new SimpleDelegate(smp.method1);
   }
}