429-JavaSE进阶String类的构造方法:

String 的构造方法 :

.toString

String(bytes)

package com.bjpowernode.javase1.string1;

public class StringTest04 {
    public static void main(String[] args) {
        String s1 = "hello word";
        System.out.println(s1);
        System.out.println(s1.toString());

        byte[] bytes = {97, 98, 99};
        String s2 = new String(bytes);

        System.out.println(s2.toString());
        System.out.println(s2);
    }
}

posted @ 2020-10-13 23:56  nkndlawn  阅读(58)  评论(0)    收藏  举报