Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

int to string??

 
gelle cerda
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so how about this message:
The method "java.lang.String getCoinName(int coinName);" must contain a return statement with an expression compatible with type "String".
I am creating a method with an original int value from the main method and it must return a string.
how can i do that?

[ November 03, 2004: Message edited by: gelle cerda ]
[ November 03, 2004: Message edited by: gelle cerda ]
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It means that you're trying to read a variable before assigning a value to it. A trivial example:



A trickier example:



In the second example i may have been assigned to before the value is assigned to j, but it also may not have been.

Make sense?
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To an outsider reading this thread, my first post above must seem very odd. I should explain that the poster asked a questiont, and when I answered it aobove, edited his original message and replaced it with a completely different question!

In any case, your method could look something like



Does this help?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic