Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #29954
| Date | 2014-09-12 21:40 +0300 |
|---|---|
| From | Donkey Hottie <donkey@fredriksson.dy.fi> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: How does it know? |
| References | <luv2fd$j58$1@dont-email.me> <luv3up$te6$1@dont-email.me> <p1kbeb-rqd.ln1@s.simpson148.btinternet.com> |
| Message-ID | <6arbeb-7lt.ln1@tempest.fredriksson.dy.fi> (permalink) |
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<String, Application> 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.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How does it know? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2014-09-12 08:11 -0700
Re: How does it know? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2014-09-12 08:36 -0700
Re: How does it know? Steven Simpson <ss@domain.invalid> - 2014-09-12 17:36 +0100
Re: How does it know? Donkey Hottie <donkey@fredriksson.dy.fi> - 2014-09-12 21:40 +0300
Re: How does it know? Joerg Meier <joergmmeier@arcor.de> - 2014-09-13 11:57 +0200
Re: How does it know? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2014-09-12 16:18 -0700
Re: How does it know? Mike Amling <mamling@chaff.us> - 2014-09-14 08:52 -0500
Re: How does it know? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2014-09-14 07:48 -0700
Re: How does it know? Roedy Green <see_website@mindprod.com.invalid> - 2014-09-12 18:11 -0700
Re: How does it know? Joerg Meier <joergmmeier@arcor.de> - 2014-09-13 11:59 +0200
Re: How does it know? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2014-09-14 07:51 -0700
Re: How does it know? Arne Vajhøj <arne@vajhoej.dk> - 2014-09-14 22:24 -0400
Re: How does it know? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2014-09-14 07:50 -0700
Re: How does it know? Arne Vajhøj <arne@vajhoej.dk> - 2014-09-14 22:26 -0400
Re: How does it know? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2014-09-17 14:52 -0700
Re: How does it know? Roedy Green <see_website@mindprod.com.invalid> - 2014-09-12 18:13 -0700
Re: How does it know? Mike Amling <mamling@chaff.us> - 2014-09-14 08:29 -0500
Re: How does it know? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2014-09-14 07:53 -0700
Re: How does it know? Roedy Green <see_website@mindprod.com.invalid> - 2014-09-17 00:40 -0700
Re: How does it know? Joerg Meier <joergmmeier@arcor.de> - 2014-09-18 00:10 +0200
csiph-web