CopyArrays
import java.util.Arrays;
public class CopyArrays
{
public static void main(String args[])
{
int []a = {1, 2, 3, 4, 500, 600, 700, 800};
int [] b,c,d;
System.out.println(Arrays.toString(a));
b = Arrays.copyOf(a,a.length);
System.out.println(Arrays.toString(b));
c = Arrays.copyOf(a,4);
System.out.println(Arrays.toString(c));
d = Arrays.copyOfRange(a,4,a.length);
System.out.println(Arrays.toString(d));
c [3] = -100;
int []tom = Arrays.copyOf(c, 6);
System.out.println(Arrays.toString(tom));
d [d.length-1] = -200;
int []jerry = Arrays.copyOfRange(d,1,8);
System.out.println(Arrays.toString(jerry));
System.out.println(Arrays.toString(a));
/*System.out.println('C'+Arrays.toString(c)+'\t');
System.out.println('d'+Arrays.toString(d)+'\t');*/
}
}
CopyArrays的更多相关文章
- Array.asList:数组转list时你一定要知道的“陷阱”!
最近开发中,业务上处理,经常用到asList方法,这让我不经想起了它的很多容易让人犯错的地方或者误解的地方,所以就想抽出时间来,整理一下,和大家分享出来,深夜了,话不多说,主要以代码为主,简易的代码, ...
- Array.asList:数组转list
String s[]={"aa","bb","cc"}; List<String> sList=Arrays.asList(s) ...
- Java题库——Chapter6 一维数组
1)What is the representation of the third element in an array called a? 1) _______ A)a(3) B) a(2) C) ...
随机推荐
- 【Leetcode】【Easy】Merge Sorted Array
Given two sorted integer arrays A and B, merge B into A as one sorted array. Note:You may assume tha ...
- oracle_union_operator
SQL: UNION Operator This SQL tutorial explains how to use the SQL UNION operator with syntax and exa ...
- 5.Zabbix 3.0案例
请查看我的有道云笔记: http://note.youdao.com/noteshare?id=15d986179cb65b45c5824e90995109ee&sub=D2E73572D97 ...
- python入门9 条件语句
条件语句: if 条件为真: 执行语句块 (执行完结束不执行elif,else) elif 条件为真: 执行语句块 (执行完结束不执行else) else: 执行语句块 #coding:utf-8 # ...
- python入门5 运算符
python运算符: 1 算术运算符 加减乘除 取余 求商 求幂等 2 比较运算符== != > >= < <= 3 逻辑运算符 and not or 4 赋值运 ...
- 关于bootstrap-table服务端分页问题
昨天项目中涉及到了前端表格分页问题.数据一共有1万多条,所以选择了后端分页. 之前用的都是前端分页,第一次使用后端分页.网上也找到了一些例子,最后做出来了. 这里用的是bootstrap-table插 ...
- html版本
1.html4/4.01 (SGML) 非常通用的语言,少写闭合,大小写混合了,浏览器都会去容错,就是html怎么写都不会导致浏览器挂掉,大家都觉得这种方式是不科学的 2.XHTML(XML) 基于x ...
- 【luogu P1195 口袋的天空】 题解
题目链接:https://www.luogu.org/problemnew/show/P1195 嗯~我是被题目背景吸引到才做的,想吃棉花糖啦! 话说回来,这道题其实很容易就能想明白,k棵最小生成树. ...
- Validform 基于表单验证
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding= ...
- RPAD()和LPAD()函数进行字符串的填充
RPAD()函数从右边对字符串使用指定的字符进行填充. 格式:RPAD(string,padded_length,[pad_string]) string 表示:被填充的字符串. padded_len ...