• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Trunning an integer to a String

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am pulling my hair out!!!
I am trying to take a interger I have (printNum)
& convert it to a String.
When I tried to do
String s = new String(printNum);
I get the follwing error
cannot resolve symbol
symbol : constructor String (int)
location: class java.lang.String
I know that there is a way to do this &
would have sworn that this was it......
BUT as reality is getting in my way.
Help

------------------
=======================
Ione Walker
walkeri@uas.net
========================
 
Ranch Hand
Posts: 297
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
String s = Integer.toString(42);
 
Ranch Hand
Posts: 233
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OR
String s = String.valueOf( printNum ) ;
 
ione walker
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you!
That is just what I wanted.

Originally posted by Richard Boren:
OR
String s = String.valueOf( printNum ) ;



------------------
=======================
Ione Walker
walkeri@uas.net
========================
 
It's a beautiful day in this neighborhood - Fred Rogers. Tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic