1. Let i, j be two integers. Write a program to exchange their values. How can you show your program is correct.
2. The identifier BufferedReader is normally abbreviated as BR in programming language C. However, Java programmers normally do not use abbreviations for identifiers. What are the advantages and disadvantages of not using abbreviations?
ans:在C語言中使用縮寫的原因是因為要節省記憶體的損耗,不過那是在之前記憶體很昂貴時,才需要這麼做。將變數已完整的名稱命名可以讓使用者更容易看懂你所編寫的程式,這是不使用縮寫的好處,壞處就是會佔更多的資源,不過這應該無傷大雅。
沒有留言:
張貼留言