Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #30962
| From | Knute Johnson <nospam@rabbitbrush.frazmtn.com> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: New Java 8 syntax? |
| Date | 2015-01-31 09:32 -0800 |
| Organization | A noiseless patient Spider |
| Message-ID | <maj3hv$b8l$1@dont-email.me> (permalink) |
| References | <mahohs$tuh$1@dont-email.me> <54ccd7df$0$288$14726298@news.sunsite.dk> |
On 1/31/2015 05:25, Arne Vajhøj wrote:
> On 1/31/2015 12:18 AM, Knute Johnson wrote:
>> So I thought that the ; was optional if you had only one statement but
>> it won't compile. If you have a block then the ;s are required.
>>
>> public class test {
>> public static void main(String... args) {
>>
>> new Thread(() -> System.out.println("hello world!") ).start();
>>
>> new Thread(() -> { System.out.println("goodbye"); } ).start();
>> }
>> }
>>
>> I bought a pretty good book, Java 8 Lambdas by Richard Warburton.
>
> The code above builds fine with both Oracle JDK and Eclipse compiler
> here.
>
> Arne
>
>
OK, I wasn't clear again. I thought that in the statement
new Thread(() -> System.out.println("hello world!") ).start();
the semicolon after the System.out.println("hello world!"); was
optional? Meaning that
new Thread(() -> System.out.println("hello world!"); ).start();
would compile. Not that leaving off the semicolon was required.
k...
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
New Java 8 syntax? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2015-01-30 21:18 -0800
Re: New Java 8 syntax? Arne Vajhøj <arne@vajhoej.dk> - 2015-01-31 08:25 -0500
Re: New Java 8 syntax? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2015-01-31 09:32 -0800
Re: New Java 8 syntax? Jeff Higgins <jeff@invalid.invalid> - 2015-01-31 12:25 -0500
Re: New Java 8 syntax? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2015-01-31 09:34 -0800
csiph-web