Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!news.dfncis.de!not-for-mail From: =?ISO-8859-15?Q?Sven_K=F6hler?= Newsgroups: comp.lang.java.programmer Subject: Re: Assigning void Date: Mon, 22 Oct 2012 11:12:28 +0200 Lines: 17 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit X-Trace: news.dfncis.de sK1kXP6JH03ekKBMWsUXeghpS1migRlBtsYM6jirTD1KcjMgU5qZ4mGpfgrpnWSbMzoVXAJl6H Cancel-Lock: sha1:MS7UiWKpNNV1C9vab/YMUWLoSCY= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121022 Thunderbird/16.0.1 In-Reply-To: Xref: csiph.com comp.lang.java.programmer:19473 Am 22.10.2012 05:20, schrieb Wojtek: > The funny thing is that I had not ever used a "void" assignment in C. I > was just coding along and I thought that using the ?: operator would be > a "neat" thing. Then the compiler complained so I changed it to an > if/else statement. In C, the line "123;" is correct syntax. (At least, gcc allows it. I didn't do more research.) In Java, no such thing is allowed. The syntax forbids it. Hence, the ?: operator must be used in a place, where some sort of value is required. For example on the right side of an assignment, or a parameter when a method is called. Regards, Sven