Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Robert Klemme Newsgroups: comp.lang.java.programmer Subject: Re: Primitive return value after exception in method Date: Mon, 02 Sep 2013 08:34:12 +0200 Lines: 29 Message-ID: References: <5222eb58$0$6555$9b4e6d93@newsspool4.arcor-online.net> <52236225$0$296$14726298@news.sunsite.dk> <522373f2$0$6568$9b4e6d93@newsspool3.arcor-online.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: individual.net YL7pa/GBqb2MjnqEOhBOjQKN24YkOAJaDenA3xDmUVPrdn6Z4= Cancel-Lock: sha1:fJ0u0w5LA6bcXzbVVkzigi/ttX0= User-Agent: Mozilla/5.0 (Windows NT 6.0; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 In-Reply-To: <522373f2$0$6568$9b4e6d93@newsspool3.arcor-online.net> X-Antivirus: avast! (VPS 130901-1, 01.09.2013), Outbound message X-Antivirus-Status: Clean Xref: csiph.com comp.lang.java.programmer:25208 On 01.09.2013 19:05, Marcel M=FCller wrote: > On 01.09.13 17.49, Arne Vajh=F8j wrote: >>> Java does not pass any arguments or return values by reference. Altho= ugh >>> the passed values might be references itself. But this makes no >>> difference here. Fred is never changed by the call to someMethod if >>> someMethod throws, regardless of its return type. >> >> I don't even think that this (for the return value) is particular >> Java specific. > > Well, it is not only Java specific, of course. But there are languages > that can return values in case of exceptions. E.g. ABAP comes into my m= ind. One can pass values back to the caller in this situation even in Java -=20 albeit not via return value. All you need to do is to pass an object=20 reference into the method and modify the state of that object before you = throw the exception. Kind regards robert --=20 remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/