This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma 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

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.
Have you checked out Aspose?
subject: Method invocation promotion in java
jQuery in Action, 3rd edition