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
Can we declare array without size in java?
Is 0 true or is 1 true?
What is the file type?
What is an example of a keyword?
Why is inheritance used in java?
What are the elements of java?
What is lazy initialization in java?
Can arraylist hold different types java?
What is a superclass?
What is difference between c++ and java ?
Why do we need wrapper classes?
Difference between vector and arraylist.
describe synchronization in respect to multithreading? : Java thread
What is a locale?
Is static variable stored in heap?