What happens when you assigned a 'double' value to
a 'String'?
Answer Posted / cleon
@Pankaj:
What are you trying to do?, trying to call a function from
primitive type/reference, that that will never work. You can
call function on Object types.
Double d = 5.5D; //D is optional as by default it is treated
to be double value
String s = d.toString();
If one tries to do something like
String s = 5.5;
A type mismatch errors will be shown during compilation itself!!
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Do I need to import java.lang package any time? Why?
What do you understand by weak reference?
What is the difference between pass by reference and pass by pointer?
Which arithmetic operations can result in the throwing of an arithmeticexception?
what is comparable and comparator interface?
How do you implement polymorphism in our day to day life?
Can list be null in java?
Can we extend private class in java?
Is main a function?
Where local and global variables are stored?
Is singleton class thread safe?
What is the purpose of abstract class?
Is sizeof a keyword in java programming?
What is the difference between JDK and JVM?
When is an object subject to garbage collection?