2007年12月27日 星期四

"Lab Static Method"

Study Display 5.2.
Using static variables and static methods to implement the class Fibonacci such that
the first call to Fibonacci.next()
returns 2, the second returns 3, and then 5, and so on.

根據Fibonacci的推算
並且將method設定為static


呼叫的時候也就不用開一個新的object來做Fibonacci級數



這也解決了之前做向量以及複數的時候
內積和複數相加
表現方式不同的原因了

沒有留言: