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


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

Re: A small quiz

From Knute Johnson <nospam@rabbitbrush.frazmtn.com>
Newsgroups comp.lang.java.programmer
Subject Re: A small quiz
Date 2015-10-01 08:22 -0700
Organization A noiseless patient Spider
Message-ID <mujj0q$ttk$1@dont-email.me> (permalink)
References <quiz-20151001125558@ram.dialup.fu-berlin.de>

Show all headers | 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