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


Groups > comp.lang.java.programmer > #34151 > unrolled thread

Re: Simple example for nested "new" expressions?

Started byRobert Klemme <shortcutter@googlemail.com>
First post2016-04-16 11:57 +0200
Last post2016-04-16 11:57 +0200
Articles 1 — 1 participant

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.


Contents

  Re: Simple example for nested "new" expressions? Robert Klemme <shortcutter@googlemail.com> - 2016-04-16 11:57 +0200

#34151 — Re: Simple example for nested "new" expressions?

FromRobert Klemme <shortcutter@googlemail.com>
Date2016-04-16 11:57 +0200
SubjectRe: Simple example for nested "new" expressions?
Message-ID<dnegjuFl516U1@mid.individual.net>
On 16.04.2016 04:09, Stefan Ram wrote:
>    I am searching for a simple example for the nesting of »new«
>    expressions, but it should not require the explanation of
>    certain »advanced« features, such as exceptions, GUI
>    classes, type arguments or class declarations.

I do not understand why one would want to teach "nested new 
expressions".  What is so special about invoking new for constructor 
arguments?  Basically you have a constructor invocation and pass on 
references.  One or more of those references just happen to point to 
objects just created on the spot themselves.

You can do this, but it seems to me as meaningless as to teach about 
nested new:

   final Long l = new Long(new Integer(123));
   final Long[] a = new Long[] { new Long(234) };
   final Long[] b = { new Long(345) };

Kind regards

	robert


-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

[toc] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web