如题,
   它的考虑到底什么?

解决方案 »

  1.   

    Because any fields you put into an interface are automatically static and final, the interface is a convenient tool for creating groups of constant values, much as you would with an enum in C or C++. For example:
    //: c08:Months.java
    // Using interfaces to create groups of constants.
    package c08;public interface Months {
      int
        JANUARY = 1, FEBRUARY = 2, MARCH = 3,
        APRIL = 4, MAY = 5, JUNE = 6, JULY = 7,
        AUGUST = 8, SEPTEMBER = 9, OCTOBER = 10,
        NOVEMBER = 11, DECEMBER = 12;

      

  2.   

    因为接口你不可以new 一个接口,也就是说它不分配任何空间,所以里面自然要有一个static空间,再加上final,你但不可以修改这个的值了,考虑了安全方面的问题
      

  3.   

    接口是个纯粹的抽象类,不提供任何具体实现,直接创建一个接口的对象是没有意义的,而且要阻止使用者去new一个接口对象,对于接口中的变量来讲,要使得在使用前已经初始化不能随意修改,出于安全的考虑.
      

  4.   

    同意 super_zzw(之支吾)说的
      

  5.   

    变量是默认 final static 的。