This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Method overloading

 
geetha nagarajan
Ranch Hand
Posts: 94
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Both //1 & //2 call test(int ,long) ,why not test(short,int).The values are within the range of short and int,right.
Pl.help.
 
Corey McGlone
Ranch Hand
Posts: 3271
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by geetha nagarajan:
The values are within the range of short and int,right.
Pl.help.

That's true, the values are within the range of a short, but literal integers in your application are automatically considered ints. Check out the JLS, §3.10.1 Integer Literals.
Corey
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic