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


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

Re: A small quiz

From Arne Vajhøj <arne@vajhoej.dk>
Newsgroups comp.lang.java.programmer
Subject Re: A small quiz
Date 2015-10-02 22:16 -0400
Organization Aioe.org NNTP Server
Message-ID <mundq2$em4$1@speranza.aioe.org> (permalink)
References <quiz-20151001125558@ram.dialup.fu-berlin.de> <mujj0q$ttk$1@dont-email.me>

Show all headers | View raw


On 10/1/2015 11:22 AM, Knute Johnson wrote:
> 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".

Not sure that I would call that a good reason.

Arne

Back to comp.lang.java.programmer | Previous | Next — Previous 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