aspose file tools*
The moose likes Beginning Java and the fly likes A stupid question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "A stupid question" Watch "A stupid question" New topic
Author

A stupid question

Hector Zoltan
Greenhorn

Joined: Dec 31, 2006
Posts: 7
I saw this code:

public class Counter {
int i;
public String toString() { return Integer.toString(i); }
}

And I was wondering, how could he overload the Integer toString method with an i parameter? I think I'm missing something here...

Anyone could help me out here please?

thanks in advance


-= "A man can pretend to be serious, but cannot pretend to be witty" =-
Anton Uwe
Ranch Hand

Joined: Jan 10, 2007
Posts: 122
Integer.toString(i) takes an int, the value of i in this case, and returns the String representation of this value.
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11422
    
  16

The API is your friend. Take a look at the .toString() methods.
[ January 16, 2007: Message edited by: Fred Rosenberger ]

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Hector Zoltan
Greenhorn

Joined: Dec 31, 2006
Posts: 7
Thanks!

now I understand
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: A stupid question