• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

regarding long and float

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i was developing the below code....




Both results in output float, float , what the reason behind that please advise and how can I call double please advise thanks a lot..!
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

saxena neera wrote:Both results in output float, float , what the reason behind that please advise and how can I call double please advise thanks a lot..!


I suggest you look here.

Winston
 
Ranch Hand
Posts: 165
Tomcat Server Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

saxena neera wrote:i was developing the below code....





Both results in output float, float , what the reason behind that please advise and how can I call double please advise thanks a lot..!



Both are returning different string objects because you are returning string only. Method parameters have nothing to do here in this case. they are not doing any job. Period
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Vinod Vijay wrote:Method parameters have nothing to do here in this case. they are not doing any job.


I think you misunderstood the issue at hand. It is entirely about method parameters, and in particular, their type. It hinges on the fact that the parameter that fits most closely is chosen, and for a long, that is float, not double.

One way to achieve this would to call the method like this: m((double) b1)
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic