Thinking In Java 学习笔记(四)

         接本系列上篇。

2.8 容器

1)容器不能保存基本数据类型

但是可以保存integer这种封装基本数据类型的类。

小贴士

Arrays.fill

static void

fill(int[] array, int value)Fills the specified array with the specified element.

static void

fill(int[] array, int start, int end, int value)Fills the specified range in the array with the specified element.

System.arraycopy

static void

arraycopy(Object src, int srcPos, Object dst, int dstPos, int length)Copies length elements from the array src, starting at offset srcPos, into the array dst, starting at offset dstPos.

Arrays.equals

static boolean

equals(int[] array1, int[] array2)Compares the two arrays.

Arrays.sort

static void

sort(int[] array)Sorts the specified array in ascending numerical order.

2)collectionmap

Collection是一组独立的元素,通常有某种规则应用于其上。List必须保留元素特定的顺序,该顺序是指元素进入List的顺序。Set必须不能出现重复元素。

Map则是一组成对的键值对对象。

3)关于容器的总结

2.9 接口

1)接口与向上转型

类可以实现多个接口,并且该类对象可以向上转型为接口。

2)extends用于继承多个类

一般extends只能继承单一的类,但是在接口继承中则没这个限制。如下代码。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值