Array, AList...

Array,AList

two elements in Array:

  1. fix length of an Array. N
  2. A sequence of N memory boxes (N = length) where all boxes are of the same type, and are numbered 0 through N - 1.

Three valid notation for array creation:

x = new int[3];
y = new int[]{1,2,3,4,5};
int[] z = {9,10,11,12};

The first two notation use new, the last one omits it.在这里插入图片描述
The first method’s default value is 0.
在这里插入图片描述
得到的结果就是empty array

在这里插入图片描述
请添加图片描述

int[] b = {9, 10, 11};
int[] x = {1,2,3,4,5,6};
System.arraycopy(b, 0, x, 3, 2);

arraycopy:

  1. the array source of arraycopy.
  2. the start copy position in array source.
  3. the destination of arraycopy
  4. the number of elements that arraycopy have to copy.
    outcome:在这里插入图片描述
    class与arrays
    class可以有不同的数据类型,array数据类型必须一样
    都有几个记忆箱去存储数据

import只能import文件夹

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值