RT,如果可以应该怎么去获取?

解决方案 »

  1.   

    接口对象里的值指什么?里面的常量?
    如果是的话,直接用  接口名.常量名 获取就可以
    接口中的常量默认是static final的
      

  2.   

    你说的接口是指定义的Interface吗?接口对象里的值可以直接获取。public interface InterfaceTest { public String name = "张三" ;
    public static String addr = "北京市" ;

     }public class Test {

    public static void main(String[] args ) {
    System.out.println(InterfaceTest.addr);
    System.out.println(InterfaceTest.name);
    }

    }
      

  3.   

    interface I{
    Date DATE = new Date();
    String S_NAME = "Jack";
    }public class Test {
    public static void main(String[] args) {
    System.out.println(I.DATE);
    System.out.println(I.S_NAME);
    }
    }
      

  4.   

    不是常量。例如定义Response是接口,Response由InfoResponse实现。
    然后通过自己定义的request方法获取到值,
    Response response;
    response = request(String res);而request()调用的是InfoResponse的构造方法
    private InfoResponse(String value)
    {
       this.value = value;
    }
    现在如何获取response中的值?
      

  5.   

    没看明白,Response由InfoResponse实现,
    那Response是实例类了啊
    但是你有说request()调用的是InfoResponse的构造方法??
    然后他的构造函数还是私有的????
      

  6.   

    InfoResponse还是个接口??接口里有构造函数??
      

  7.   



    你弄反了吧
    Response是接口,由类InfoResponse实现。
    InfoResponse的构造方法是公有的。
      

  8.   

    request()这个方法代码贴下 它返回的是什么?
      

  9.   

    Response response;
    response = request(String res);
    之后用response取不出来什么值?InfoResponse中新声明的而Response中没有的?还是Response中本来就声明的公共变量?
      

  10.   


    返回的就是Response的接口对象。