auto boxing

S

Shin

why not auto boxing support in this case:

int i ...;
double d ...;

Object[] a = new Object[] {i, d};

what is the argument? It seeems desirable and doesn't terribly
complicates the language design?

[hopefully we don't have to get caught in the argument that "everyone
wants to add his own thing, blah..."]

-Shin
 
J

Joan

Shin said:
why not auto boxing support in this case:

int i ...;
double d ...;

Object[] a = new Object[] {i, d};

what is the argument? It seeems desirable and doesn't terribly
complicates the language design?

[hopefully we don't have to get caught in the argument that
"everyone
wants to add his own thing, blah..."]

-Shin

I cut and pasted it and it compiles with no error for me.
 
J

Joan

Joan said:
Shin said:
why not auto boxing support in this case:

int i ...;
double d ...;

Object[] a = new Object[] {i, d};

what is the argument? It seeems desirable and doesn't terribly
complicates the language design?

[hopefully we don't have to get caught in the argument that
"everyone
wants to add his own thing, blah..."]

-Shin

I cut and pasted it and it compiles with no error for me.

It even runs:
-------------
class A {
public static void main(String[] args) {
int i = 1;
double d = 2.0;
Object[] a = new Object[] {i, d};
System.out.println(a[0]);
System.out.println(a[1]);
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top