• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

why integer method is choosed and why string is choosed?

 
Ranch Hand
Posts: 689
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
here i am writing 2 programs with overloaded methods



here is the string problem



why int method is called why not long method?
and why String class is choosen when i have Object parameter ?
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the first instance writing literal value in your code will result in the values being an int. If you don't want this, signal that you don't, like this:

(just to make it clear, that is a lower-case L after the int value)

In the second case, primitive values cannot be null, so there is only really one method that can be called, i.e. the one that takes an Object as a parameter.
[ September 26, 2006: Message edited by: Paul Sturrock ]
 
Ranch Hand
Posts: 1249
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by saikrishna cinux:
here i am writing 2 programs with overloaded methods

why int method is called why not long method?
and why String class is choosen when i have Object parameter ?



Well you must be satisfied with the answer of the first question.

For question Number # 2.

You must look at .

Choose the Most Specific Method.

This will helps you a lot ......I am quite sure.
 
saikrishna cinux
Ranch Hand
Posts: 689
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ankur Sharma:


Well you must be satisfied with the answer of the first question.

For question Number # 2.

You must look at .

Choose the Most Specific Method.

This will helps you a lot ......I am quite sure.



no ,sorry i couldn't able to understand it
can you please explain me more
 
Shaan Shar
Ranch Hand
Posts: 1249
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by saikrishna cinux:


no ,sorry i couldn't able to understand it
can you please explain me more



Could you please come up what you really not able to understand Question # 1 or Question # 2....
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic