Preview:
interface Refer{
    String m(String s);
}

class StringOperation{
    public String reverse(String s){
        String r = "";
        for(int i = s.length()-1;i>=0;i--)
            r+=s.charAt(i);
        return r;
    }
}

public class ReferDemo{
    public static String m(Refer r, String s){
        return r.m(s);
    }
    
    public static void main(String[] args){
        String s = "hello";
        System.out.println(m((new StringOperation()::reverse), s));
    }
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter