aspose file tools*
The moose likes Beginning Java and the fly likes int to string?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "int to string??" Watch "int to string??" New topic
Author

int to string??

gelle cerda
Greenhorn

Joined: Sep 28, 2004
Posts: 2
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

Joined: Jul 08, 2003
Posts: 24187
    
  34

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?


[Jess in Action][AskingGoodQuestions]
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

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?
 
 
subject: int to string??