Java Puzzlers筆記--puzzle 22:Dupe of URL url的使用

public class BrowserTest{
 public static void main(String[] args){
  System.out.println("iexplore.exe");
  http://www.google.com
  System.out.println(":maxmize");
 }

Solution:

               顯示:iexplore.exe

                           :maxmize

               由於URL在java中被認爲是註釋,不做任何事情

TID:

         The URL that appears in the middle of the program is a statement lable followed by an end-of-line comment.

          The lesson of this puzzle is that misleading comments and extraneous code cause confusion. Write comments carefully and keep them up to date. Excise dead code.

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章