-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 に答える