I have a method that requires a Number as an argument
If I do this
Double x = new Double("2");
numberMethod(x);
It doesn't compile with a not found error
nor does
numberMethod((Number)x);
where as
numberMethod(new Double(x));
does compile. Can any one explain it?
Bob
ByteCoder - 30 Dec 2004 17:00 GMT
> I have a method that requires a Number as an argument
>
[quoted text clipped - 15 lines]
>
> Bob
Could you display the error message?

Signature
-------------
- ByteCoder - ...I see stupid people
-------------
Curiosity *Skilled* the cat
klynn47@comcast.net - 30 Dec 2004 17:05 GMT
Could you post the code and the error messages?
Ryan Stewart - 30 Dec 2004 19:07 GMT
>I have a method that requires a Number as an argument
>
[quoted text clipped - 4 lines]
>
> It doesn't compile with a not found error
My guess is your "x" has gone out of scope, but as others have said, post
some code. See:
http://www.physci.org/codes/sscce.jsp
Tony Morris - 30 Dec 2004 22:48 GMT
> I have a method that requires a Number as an argument
>
[quoted text clipped - 15 lines]
>
> Bob
Your problem description is incorrect.
Please state is correctly.
Also, state whether you are using a 1.5 or lower compiler.
Here's some trivia for the curious:
Does this compile on <=1.4 and/or 1.5? why (not)?
double[] d = new double[0].clone();

Signature
Tony Morris
http://xdweb.net/~dibblego/
Ryan Stewart - 30 Dec 2004 23:45 GMT
> Here's some trivia for the curious:
> Does this compile on <=1.4 and/or 1.5? why (not)?
>
> double[] d = new double[0].clone();
Well, first I'm interested in why it compiles without a cast. Second, I know
that some compilers used to think that cloning an array could throw a
CloneNotSupportedException. Is that what you're referring to?