What happens when you assigned a 'double' value to
a 'String'?
Answer Posted / pankaj
hi,
toString() method will also not work here.
double d=10.5;
String str= d.toString();
E:\Programs>javac conversionTest.java
conversionTest.java:6: double cannot be dereferenced
String str= d.toString();
^
1 error
The only way I found is as below and is working fine.
double d=10.5;
String str= ""+d+"";
System.out.println(str);
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
Implementations of set interface?
Which is better ascii or unicode?
Is main an identifier?
How to create a custom exception?
What does @param args mean in java?
How many types of memory areas are allocated by JVM in java?
What is difference between fileinputstream and filereader in java?
How do you achieve polymorphism in java?
What is an off by one error in java?
Is java se open source?
How can I debug the Java security exceptions and AccessControlExceptions?
what is meant by HQL?
Does java allow default arguments?
Explain the available thread states in a high-level?
What do you mean by mnemonics?