aspose file tools*
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 Java 8 in Action this week in the Java 8 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.
It is sorta covered in the JavaRanch Style Guide.
subject: Method invocation promotion in java
Similar Threads
More specific method
Need clarification on overloaded method?
lil confused!!
integer literals
How to get a base class subobject