请问有关 interface 里变数的问题…

Home Home
引用 | 编辑 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 里变数的问题…: 到引言文
最近看了 SCJP 6.0 有个疑问…
SCJP 6.0 的第69题是
[code]11. public interface Status {
12.   /* insert code here */ int MY_VALUE = 10;
.......





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