X-Received: by 10.182.130.168 with SMTP id of8mr5638335obb.27.1410547263419; Fri, 12 Sep 2014 11:41:03 -0700 (PDT) Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!r10no960907igi.0!news-out.google.com!ef6ni5169igb.0!nntp.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!news.giganews.com.POSTED!not-for-mail NNTP-Posting-Date: Fri, 12 Sep 2014 13:41:02 -0500 Date: Fri, 12 Sep 2014 21:40:38 +0300 From: Donkey Hottie User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 Newsgroups: comp.lang.java.programmer Subject: Re: How does it know? References: In-Reply-To: Message-ID: <6arbeb-7lt.ln1@tempest.fredriksson.dy.fi> Lines: 40 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-HQT1K909W+t6uoHUEDAWYKyMWpiBbYbdg6thLpDx5f/OIB32EmtKHVlhwir2rMToz1d8wjpN69Qfor2!LpjO50a8mV3dep47SeODmA7lbJ0gefSbwlPIhzDfaRY47dyqxxAiMLrJu6CYm69fxhPWVg== X-Complaints-To: abuse@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2197 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Xref: csiph.com comp.lang.java.programmer:29954 12.09.2014, 19:36, Steven Simpson kirjoitti: > On 12/09/14 16:36, Knute Johnson wrote: >> On 9/12/2014 08:11, Knute Johnson wrote: >>> The second question is, what type is test.main()? I want to be able to >>> put it into a Map. >> >> Now that I think about it, I don't think that is possible. > > import java.util.*; > > public class TestApplication { > public interface Application { > void main(String... args) throws Exception; > } > > public static void main(String[] args) { > Map map = new HashMap<>(); > map.put("self", TestApplication::main); > } > } > > > That does not compute. Or is this some Java 8 new feature? I thought methods are not "first class citizens" in Java... I would say map.put("something", new Application { void main(String... args) throws Exception { throw new Exception("WTF?"); } }); -- Avert misunderstanding by calm, poise, and balance.