Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

what is use of functional interface in java 8?

1022


What is boolean strategy?

1134


What is the use of callablestatement?

1020


What is the difference between class & object?

1018


What is a map in java?

989


What is a bufferedreader?

1095


What is the difference between ArrayList and Vector? which one is better in Java

1141


How can we make a class singleton?

1073


What does java se mean?

1029


Is it possible to override private or static method in java?

996


How will you call an Applet using Java Script Function?

1034


How do you declare a string variable?

1018


Name few "optional" classes introduced with java 8 ?

1136


What is Garbage Collection in Java

1084


Does sprintf allocate memory?

1111