473,473 Members | 1,512 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

corejava

1 New Member
hi,
can u tell me how to convert a double value(10.0) to String value "10.00"
May 12 '07 #1
4 1173
rsrinivasan
221 New Member
Hi,

You can convert double value to string value by using valueOf() function of String class.

For Example:

public class ConvertDouble
{
public static void main(String[] args)
{
double d=4.0;
String str= String.valueOf(d);
System.out.println(str);
}
}
May 12 '07 #2
JosAH
11,448 Recognized Expert MVP
hi,
can u tell me how to convert a double value(10.0) to String value "10.00"
If you want those two decimal digits you have to use a DecimalFormat.

kind regards,

Jos
May 12 '07 #3
parthpatel
14 New Member
class convert {
double d = 4.0;
String s = ' ' + d;
System.out.println(s);
}
May 12 '07 #4
parthpatel
14 New Member
class convert {
public static void main(String args[]){
double d = 4.0;
String s = ' ' + d;
System.out.println(s);
}
}
May 12 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: dklaming | last post by:
I am trying to work through some examples in CoreJava V2. The authors claim that I do not need to use rmic to generate stub classes. However, unless I use rmic then I get Unmarshalled Parameter...
16
by: Paul Prescod | last post by:
I skimmed the tutorial and something alarmed me. "Strings are a powerful data type in Prothon. Unlike many languages, they can be of unlimited size (constrained only by memory size) and can hold...
13
by: java4all | last post by:
public class Test { public static void main(String args) { HashSet s = new HashSet(); for(short i = 0; i<100;i++){ s.add(i); ...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.