File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 REST with Spring (video course) this week in the Spring 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
It's not a secret anymore!