• Post Reply Bookmark Topic Watch Topic
  • New Topic

Incompatible types  RSS feed

 
Pan Niko
Ranch Hand
Posts: 86
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have the method bellow

and compiler error


If i remove the df.format() and return just the total, working fine but with many decimals/
Any idea why that error?
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pan Niko wrote:
If i remove the df.format() and return just the total, working fine but with many decimals/
Any idea why that error?


Not sure of your confusion -- isn't the error message clear?

You declared your method to return a double, but the type returned by the format() method, which you are in turn, trying to return from your method, is a String.

Henry
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!