如何将某个索引中的String
复制到String
中的另一个Java
示例:String s[] = {"0","a","b","c","d","e"};
需要从索引1复制字符串s
- 休息到另一个字符串s1
(字符串s1 [])
请帮助解决这个问题
答案 0 :(得分:1)
使用SDK中的System.arraycopy来获得结果。
答案 1 :(得分:0)
public static void main(String[] args) throws Exception {
String s[] = {"0","a","b","c","d","e"};
String s1[] = Arrays.copyOfRange(s, 1,s.length);// copies content from s 1 index to rest
System.out.println(s1);
}