摘要:
定义一个抽象的IntQueue类 abstract class IntQueue { def get(): Int def put(x: Int) } IntQueue的基本实现BasicIntQueue class BasicIntQueue extends IntQueue { private 阅读全文
posted @ 2020-12-06 11:40
地中有山
阅读(89)
评论(0)
推荐(0)
摘要:
Ordered特质为你定义了<、>、<=和>=这些方法都是基于你提供的compare来实现的。因此,Ordered特质允许你只实现一个compare方法来增强某个类,让它拥有完整的比较操作。 object Rational{ def main(args: Array[String]): Unit = 阅读全文
posted @ 2020-12-06 10:40
地中有山
阅读(110)
评论(0)
推荐(0)

浙公网安备 33010602011771号