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 regex in java?

991


What is merge sort in java?

1029


Can a top level class be private or protected?

1095


What is rule of accessibility in java?

1081


What is the use of 'super' keyword inside a constructor?

1018


How to find the largest value from the given array.

1066


How do you sort objects in java?

1034


Why super is first line in java?

1099


What is oop in java?

1164


What are the difference between string, string builder, and string buffer in java?

1169


What do you mean by ordered and sorted in collections in java?

1040


Define an applet in java?

1229


Why volatile is used in java?

1144


What is the default access specifier for variables and methods of a class?

1253


Can we execute a program without main() method?

1087