如果音樂創作是一種程式設計
那樂譜就是原始碼
記譜方式就是程式語言
調性就是framework
和絃就是API
音階是class
音符是變數
節奏是迴圈
旋律是程式邏輯
和聲是多執行緒
樂器是compiler
錄音是binary
現場演奏是即時編譯
即興演奏是動態連結
音樂就是一個程式
又如果程式設計是一種音樂創作...
20090305
20081001
JAVA系列 - equal的String不==
結果很機車耶...
String s1 = "Hello world!";
String s2 = "Hello world!";
System.out.println("s1: " + s1);
System.out.println("s2: " + s2);
System.out.println("s1==s2: " + (s1 == s2));
s1 = "Hello world!Hello world!".substring("Hello world!".length());
System.out.println("s1: " + s1);
System.out.println("s2: " + s2);
System.out.println("s1==s2: " + (s1 == s2));
大概是因為substring出來的String是放在正常的heap
而不是Pool
String s1 = "Hello world!";
String s2 = "Hello world!";
System.out.println("s1: " + s1);
System.out.println("s2: " + s2);
System.out.println("s1==s2: " + (s1 == s2));
s1 = "Hello world!Hello world!".substring("Hello world!".length());
System.out.println("s1: " + s1);
System.out.println("s2: " + s2);
System.out.println("s1==s2: " + (s1 == s2));
大概是因為substring出來的String是放在正常的heap
而不是Pool
訂閱:
文章 (Atom)