This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Method invocation promotion in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Method invocation promotion in java" Watch "Method invocation promotion in java" New topic

Method invocation promotion in java

Abimaran Kugathasan
Ranch Hand

Joined: Nov 04, 2009
Posts: 2066

The result is short. My question is, When a method is called, What about method invocation promotion? byte, short, char are promoted to int and passed to corresponding method with signatures. Is that correct?

Thanks in advanced!

|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
Venu Chakravorty
Ranch Hand

Joined: Aug 19, 2009
Posts: 46
A datatype (here byte) is promoted to the narrowest datatype (here short) that is big enough to hold the value (here 100).

regards, venu.
I agree. Here's the link:
subject: Method invocation promotion in java
Similar Threads
lil confused!!
How to get a base class subobject
More specific method
integer literals
Need clarification on overloaded method?