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 call the run() method instead of start()?
Difference between operator overloading and function overloading
Is hashset sorted in java?
Why deletion in linkedlist is fast than arraylist?
How can you avoid serialization in child class if the base class is implementing the serializable interface?
What does a void function return?
How destructors are defined in java?
Is java hard to learn?
What happens when a thread cannot acquire a lock on an object in java programming?
Why runnable interface is used in java?
What is used of static keyword in java?
What are sets in java?
What is a class object?
What do you mean by aggregation?
What does += mean coding?