package com.fqs.demo005; public class S { public static void main(String[] args) { //1 基本的字符串 String s="abc"; System.out.println(s); //2. new 一个对象 String s2=new String(); System.out.println("!!"+s2+"!!"); //3.传递一个字符串 对象 String s5=new String("abcabc"); System.out.println(s5); //4.传递一个字符 数组 对象 ; 为了方便之后将abc 改成Gbc char[]chs={'a','b','c'}; String s4=new String(chs); System.out.println(s4); //5. 传递一个字节数组 ,根据字节数组的内容再创建一个新的字符串对象 byte[]bytes={97,98,99,100}; String s6=new String(bytes); System.out.println(s6); } }