public class Main {
public static void main(String[] args)
{
//能将ascii值的byte数组 转换成字符串
byte[] arr={65,66,67,68,98,99,100};
String s1=new String(arr);
System.out.println("Byte数组转字符串:"+s1);
//字符数组转字符串
char[] chars={'a','b','c','D','E','F'};
String s2=new String(chars);
String s3=new String(chars,1,4);
System.out.println("字符数组转字符串:"+s2);
System.out.println("字符数组转字符串(截取一部分):"+s3);
}
}
输出结果: