Difference between a string and an array of characters

前端 未结 7 2041
一整个雨季
一整个雨季 2021-02-01 10:18

How are these declarations different from each other?

String s=\"MY PROFESSION\";
char c[]=\"MY PROFESSION\";

What about the memory allocation

相关标签:
7条回答
  • 2021-02-01 11:04

    char is a primitive type while String is a class. An array of a specified number of strings and strings are a bundle of characters.

    0 讨论(0)
提交回复
热议问题