In Java can you do a function literal like you can in JavaScript?
JS example:
Code:var i = (function(){return 10;})();
In Java can you do a function literal like you can in JavaScript?
JS example:
Code:var i = (function(){return 10;})();
No.
Java doesn't support anonymous functions of any kind. If you want to move methods around, you have to use the Method class from the java.lang.reflection package.
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
Bookmarks