Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Beginning Java
Search Coderanch
Advance search
Google search
Register / Login
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
Forum:
Beginning Java
Turning an int into a String
Mike Fourier
Greenhorn
Posts: 25
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
So I've inherited a codebase. And pretty much everywhere that an object returns an int, where a
String
is desired, I find code like this:
String invoiceId = new Integer(invoice.getInvoiceId()).toString();
Is there some sort of advantage to that code, that I don't understand? I mean: why not just this:
String invoiceId = String.valueOf(invoice.getInvoiceId());
Paul Clapham
Marshal
Posts: 28193
95
I like...
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
It's possible that the advantage was simply that the original programmer knew how to write that code but didn't know how to write your suggested replacement.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Design pattern to compare object based on inherited properties
prepareStatement returns 0?
View several XSL documents in one HTML page
prepareStatement returns 0?
autoincrement invoice
More...