这将返回一个String,它表示指定数组中的字符序列。
这是此方法的语法-
public static String copyValueOf(char[] data, int offset, int count)
这是参数的详细信息-
链接:https://www.learnfk.comhttps://www.learnfk.com/java/java-string-copyvalueof-dataoffsetcount.html
来源:LearnFk无涯教程网
data - 字符数组。
offset - 子数组的初始偏移。
count - 子数组的长度。
此方法返回一个包含字符数组字符的字符串。
public class Test { public static void main(String args[]) { char[] Str1={'h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd'}; String Str2=""; Str2=Str2.copyValueOf( Str1, 2, 6 ); System.out.println("Returned String: " + Str2); } }
这将产生以下输出-
Returned String: llo wo
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)