Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #32750

Re: A small quiz

Path csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From Knute Johnson <nospam@rabbitbrush.frazmtn.com>
Newsgroups comp.lang.java.programmer
Subject Re: A small quiz
Date Thu, 1 Oct 2015 08:22:58 -0700
Organization A noiseless patient Spider
Lines 23
Message-ID <mujj0q$ttk$1@dont-email.me> (permalink)
References <quiz-20151001125558@ram.dialup.fu-berlin.de>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 8bit
Injection-Date Thu, 1 Oct 2015 15:20:58 +0000 (UTC)
Injection-Info mx02.eternal-september.org; posting-host="e4bb2c7dad0e79edbbf184ec68513a50"; logging-data="30644"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19pjOwYzeUxjikgOJv8ITYe"
User-Agent Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0
In-Reply-To <quiz-20151001125558@ram.dialup.fu-berlin.de>
Cancel-Lock sha1:vZPUNqtnjSKqZz9BhCNvkVuxVOw=
Xref csiph.com comp.lang.java.programmer:32750

Show key headers only | View raw


On 10/1/2015 05:02, Stefan Ram wrote:
>    A method m() is declared to have a return type of java.lang.String:
>
> java.lang.String m()
>
>    . A programmer writes this expression:
>
> java.lang.String.valueOf( m() )
>
>    (The scope is so that »m« in the above expression refers to the
>    method »m()« as declared above.)
>
>    . Can you find out what might be a good reason the programmer might
>    have to write this expression? Since the return type of m() already
>    /is/ java.lang.String, the call to »java.lang.String.valueOf« seems
>    to be completely superfluous!
>

If m() returns null String.valueOf would return "null".

-- 

Knute Johnson

Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Re: A small quiz Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2015-10-01 08:22 -0700
  Re: A small quiz Arne Vajhøj <arne@vajhoej.dk> - 2015-10-02 22:16 -0400

csiph-web