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
What is scope of a variable?
Can an integer be null java?
Does java vector allow null?
What is dot operator?
What is tcp ip in java?
Difference between static binding and dynamic binding?
What does string mean in java?
Does string is thread-safe in java?
How to provide security in java
What are static variables and functions?
What is garbage collection? What is the process that is responsible for doing that in java?
What is java abstraction with example?
How will you reverse a singly-link list?
How big is a gigabyte?
What is a generic type?