Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!border3.nntp.dca.giganews.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: Sat, 13 Oct 2012 09:07:02 -0500 Date: Sat, 13 Oct 2012 17:06:50 +0300 From: Donkey Hottie User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120912 Thunderbird/15.0.1 MIME-Version: 1.0 Newsgroups: comp.lang.java.programmer Subject: Re: Assigning void References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Message-ID: Lines: 28 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-Q2pQdyuxbKW9hLdPT0u3IJfjRAWgUcCLh2sBjK9F0JvdIg786kxKDrF02+JZXmVfx7vvzLi1CI0BrIm!CpKAXLUoKalvSWcEkocvkCTSE4NSbKvYrbUaPzpOZeMCh9hC8qu/UeO24MCYWBd3RwWC 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: 1973 Xref: csiph.com comp.lang.java.programmer:19279 13.10.2012 08:54, Wojtek kirjoitti: > I can legally do the following: > > if (server.getConnectionType() == ConnectionType.ACTIVE) > ftp.enterLocalActiveMode(); > else > ftp.enterLocalPassiveMode(); > > but I want to do: > > (server.getConnectionType() == ConnectionType.ACTIVE) ? > ftp.enterLocalActiveMode() : ftp.enterLocalPassiveMode(); > > However the compiler insists that I must have an assignment even though > both ftp methods return void. I would think that the compiler would be > smart enough to realize that nothing CAN be returned. > > Oh yes, I am using Eclipse with Java 7 > > Thoughts? I mean other than stylistic comments... > Why do you want to use an assignment statement without need or means to assign anything to anywhere? What's the rationale? -- You can rent this space for only $5 a week.