Why String can accept all data type ???? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why String can accept all data type ????

15th Sep 2017, 9:15 PM
mohit thakor
mohit thakor - avatar
3 Answers
+ 10
"11" is a string literal. 11 is an integer. They are different.
16th Sep 2017, 3:02 AM
Hatsy Rei
Hatsy Rei - avatar
0
@luka it accepts all data types if we dont forget to add " ". string s = " 11 " ; //any objections ?
16th Sep 2017, 2:56 AM
Shibopie
Shibopie - avatar
0
Coz it's possible to convert any data to string
16th Sep 2017, 8:00 AM
Siroj Samadov
Siroj Samadov - avatar