引用 | 編輯
a7811311622
2013-10-30 20:58 |
樓主
▼ |
||
x0
最近看了 SCJP 6.0 有個疑問…SCJP 6.0 的第69題是 11. public interface Status { 12. /* insert code here */ int MY_VALUE = 10; 13. } Which three are valid on line 12? ( .. 訪客只能看到部份內容,免費 加入會員 x0
|
引用 | 編輯
ReZa
2013-11-03 18:05 |
1樓
▲ |
下面是引用 a7811311622 於 2013-10-30 20:58 發表的 請問有關 interface 裡變數的問題…: 69題疑問看不懂 不過下面那堤題你的疑問是 修飾詞是甚麼東西?? 是 String s =new String("YA"); 這種意思嗎?? 我剛測試了一下編譯 以下都沒有錯誤與警告 所以 說 String s= "yo"; or String s = new String("yo"); 的意思是相同的 看你怎麼使用 public class asd { public static void main(String[] args) { String s = "yo"; String a =new String("YA"); System.out.printf("%s , %s",s,a); 或者以下都可以編譯完成 String s = ""; String a =new String(""); System.out.printf("%s , %s\n",s,a); s = "be"; a = "yoa"; System.out.printf("%s , %s\n",s,a); } } x0 |