Difference between a string and an array of characters

前端 未结 7 2057
一整个雨季
一整个雨季 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.

提交回复
热议问题