Arrays

Arrays provide fast random access by letting you use an index position to get any element in the array.

– Arrays must be given a size! – Determining the size of an array

Arrays declartaion: TypeName[] Array

Create an int value array:1.declare an array and determine the size of the array(int[] num=new int[7])

2.Given an element of each array

Things to remember about arrays …

• An array is an object, even though it may be an array of primitives! • Array elements can be either primitives or objects.

The"String[] args"in main method is also an array

Create an array of objects:

1.Declare array 2.Create new array with a length 3.Give each element in the array a value

Printing arrays and the toString() method

重写toString方法以获取想要的结果,否则只能得到哈希值

Copying Arrays

Reference copying is true, regardless of whether your array contains primitive or reference variables. • THREE ways copy the data type variables: 1. Use a loop to copy all individual elements. 2. Use the static arraycopy method in the System class. 3. Use the clone method to copy arrays. (Out of scope)

passing arrays to method

The idea of javadocs is to be able to easily generate a code “maintenance manual”. • Run the javadoc tool over the source code, to parse the declarations and Doc comments, generating a set of HTML pages. • General form of Doc comments – A Doc comment is made up of two parts: a description, followed by zero or more tags, with a blank line (containing a single asterisk (*)) between these two sections.

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值