Long story

J

jupiter

I had a case where Long.toString(); in my method compiled and I
could not understand why such behavior. Since the no-arg overload
of toString() is an instance version, the class appeared to be
using the instance version.

???

Dumb gringo had passed an arg to the method named Long. How sweet
is that? When I wrote Long.toString() the compiler was deciding to
use the arg Long, not the wrapper Long.

Dumb dee dumb dumb. Just because it's legal don't mean it's right.

Lingering issue: I'm not sure about the rules of precedence and why
it chose the arg Long instead of the wrapper Long.

Was that story too Long? Maybe I should have tried it with Short.

- Martin Short.
 
D

Daniel Pitts

jupiter said:
I had a case where Long.toString(); in my method compiled and I
could not understand why such behavior. Since the no-arg overload
of toString() is an instance version, the class appeared to be
using the instance version.

???

Dumb gringo had passed an arg to the method named Long. How sweet
is that? When I wrote Long.toString() the compiler was deciding to
use the arg Long, not the wrapper Long.

Dumb dee dumb dumb. Just because it's legal don't mean it's right.

Lingering issue: I'm not sure about the rules of precedence and why
it chose the arg Long instead of the wrapper Long.

Was that story too Long? Maybe I should have tried it with Short.

- Martin Short.

Funny story, although the term gringo is a little offensive.

Better than BigInteger Story :)
 

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

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top