-2

有人可以帮我弄这个吗?

GlobalCredit credit1 = new GlobalCredit().getRandom();
GlobalCredit rewardCards = new GlobalCredit();

这就是课堂。

http://www.cse.yorku.ca/common/type/api/type/lib/GlobalCredit.html

当我打印 credit1 和/或 rewardCards 时,它们每次都会输出一个随机数量。奖励卡不应该是空的吗?

4

1 回答 1

1

看看类的toString()方法GlobalCredit

System.out.println(credit1)

以上语句打印credit1.toString()

根据文档

the string "Global Credit Company [title]: CARDS=xx" , where title is the GCC's name and xx is the actual number of cards in the collection.
于 2012-07-26T06:08:15.663 回答