java-- string and char

Note: String objects are stored in a special memory area known as the "string constant pool".

  • features
    - immutable

image

str is a string
make string sorted;
``

   //sort 
    char ch[] = str.toCharArray();
    Arrays.sort(ch);
    String strSorted = new String( ch.length;);

``

posted @ 2022-07-06 13:20  奋斗中的菲比  阅读(12)  评论(0编辑  收藏  举报