随笔分类 - scala入门
摘要:1、编写⼀个BankAccount类,假如deposit和withdraw⽅法,和⼀个只读的balance属性。 2、编写Person类,主构造器接受⼀个字符串,字符串形式为名字,空格,姓,如 new Person(“Fred Smith”)。提供只读属性firstName和lastName。 3、
阅读全文
摘要:以下是scala简单的入门题~ 1、⼀个数字如果为正数,则它的signum为1;如果是负数,怎么signum为-1;如果是0,则signum 为0.编写⼀个函数来计算这个值。 2、针对下列Java循环编写Scala版本 for(int i=10; i>=0;i- -) System.out.prin
阅读全文