-2

I know this question has been answered a few times by other users from different context, but i would like to know this from Java language user perspective. And i know the immuatble difference please mention any other diference if any.

  • Related: http://stackoverflow.com/questions/8881291/why-is-char-preferred-over-string-for-passwords-in-java/ – RaminS Aug 21 '16 at 17:07
  • https://www.bing.com/search?q=java%20String%20vs.%20Char%20array – Alexei Levenkov Aug 21 '16 at 17:23
  • Class and array are different structures. They both have different interface. Java has pool for String literals. Single char can't represent all symbols like ones created by surrogate pairs (), so String also provides support for codepoints, not only characters. – Pshemo Aug 21 '16 at 17:25
  • @AlexeiLevenkov My eyes! It burns! – RaminS Aug 21 '16 at 17:34

1 Answers1

1

String is the class that contains into itself char array, as well as different ready methods for you. When you use simply char array you must implement your own methods, while String has already built-in popular and optimized methods.

Turkhan Badalov
  • 668
  • 1
  • 9
  • 17