copyOf和copyOfRange()的使用方法
来源:互联网 发布:英语图表数据作文模板 编辑:程序博客网 时间:2024/06/04 00:48
import java.util.*;;
public class Example7_4 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int [] a={11,22,33,44,55},b,c,d;
System.out.println("数组a中各元素的值为:");
System.out.println(Arrays.toString(a));
b=Arrays.copyOf(a,8);
System.out.println("数组b中各元素的值为:");
System.out.println(Arrays.toString(b));
c=Arrays.copyOfRange(a,0,4);
System.out.println("数组c中各元素的值为:");
System.out.println(Arrays.toString(c));
d=Arrays.copyOfRange(a,3,10);
System.out.println("数组d中各元素的值为:");
System.out.println(Arrays.toString(d));
}
}
//注意:Arrays.copyOf(a,length)和Arrays.copyOfRange(a,to,from)中,length代表新数组的长度,而对Arrays.copyOfRange(a,to,from)而言,其长度为from-to,数组是从a{from]到
a[to-1]的。
- copyOf和copyOfRange()的使用方法
- Arrays.copyOf()&Arrays.copyOfRange()
- Arrays.copyOfRange的用法
- System.arraycopy和Arrays.copyOfRange的详细区别
- System.arraycopy()和Arrays.copyOf()的区别
- System.arraycopy 和 Arrays.copyOf()的区别
- System.arraycopy()和Arrays.copyOf()的区别
- System.arraycopy()和Arrays.copyOf()的区别
- Arrays 的copyOf() - JDK 6 和操作符 instanceof
- System.arraycopy、Arrays.copyOf和ArrayList的toArray介绍
- Arrays.copyOf和System.arraycopy之间的区别
- Java中System.arraycopy()和Arrays.copyOf()的区别
- Arrays 的copyOf()
- Java :Arrays 的copyOf()
- Arrays.copyof的用法
- Arrays 的copyOf()
- Arrays.copyOf(...)和System.arraycopy(...)
- Arrays.copyOf 和System.arraycopy
- 进程间通信方式对比
- linux SElinux的设置
- 在时间路上
- PHP设计模式之-----适配器模式
- oracle分区
- copyOf和copyOfRange()的使用方法
- H5前端基础——布局
- Oracle 行迁移详解
- 基于Nginx+Spring Boot+Swagger的api文档实践
- Java垃圾回收——三种回收机制
- 外网通过VPN技术访问公司内网服务器(192.168.x.xxx)
- SSM项目整合笔记-Eclipse搭建Maven开发环境
- 几道前端面试题
- POJ—3984(迷宫问题)