Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

conversion

 
mer imperio
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anybody from the group who can give help. I am using java applets. I want to convert the long or double data type to its string equivalent so that I can display it in textbox. What will i do? What is the code? Pls. help me... Thnks in advanced
 
Sonny Gill
Ranch Hand
Posts: 1211
IntelliJ IDE Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at the javadocs for valueOf(..) methods in String class (java.lang) package
Java docs
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am going to move this to the more appropriate Java In General (Beginner) forum.

This forum is for Servlets questions.

Mark
 
Shashank Agarwal
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's the code to convert a double into its string equivalent -

Double d = 123;
String s = Double.toString(d);

You may also set the text in the textbox directly

textboxobject.setText(Double.toString(d));

Cool, huh!!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic