Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #32750 > unrolled thread
| Started by | Knute Johnson <nospam@rabbitbrush.frazmtn.com> |
|---|---|
| First post | 2015-10-01 08:22 -0700 |
| Last post | 2015-10-02 22:16 -0400 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.java.programmer
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
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
| From | Knute Johnson <nospam@rabbitbrush.frazmtn.com> |
|---|---|
| Date | 2015-10-01 08:22 -0700 |
| Subject | Re: A small quiz |
| Message-ID | <mujj0q$ttk$1@dont-email.me> |
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
[toc] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2015-10-02 22:16 -0400 |
| Message-ID | <mundq2$em4$1@speranza.aioe.org> |
| In reply to | #32750 |
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
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web