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
Why do we need strings in java?
Can we overload the constructors?
What do you mean by hashing?
What is logical variable?
What are the two types of java?
how to deploy tomcatserver to weblogic server? write d following steps?
What is the difference between exception and error in java?
What are the differences between throw and throws?
Can java cast null?
Explain where variables are created in memory?
Hi friends am new to java. I read jar file means collection of java files. For executing struts application what are the necessary jar files. " struts.jar " file contains what. can u explain
Is there a case when finally will not execute?
Is integer a class?
Is a class an object?
Can you call a method on a null object?