两者都是获得数组的长度,谁能说说在用法上有什么区别?

解决方案 »

  1.   

    不可以的啊
    length是数组的属性
    length()是String类型的方法
      

  2.   

    楼主的问题是否有些问题?
    “getlength()和length  两者都是获得数组的长度”???数组是通过length属性得到长度的
    具体对象是通过length()方法得到长度的,也有使用getlength()方法的(如果可以得到长度)好像暂没见过同时通过 getlength()和length 访问长度的
      

  3.   

    谁能给说说length,length(),getlength()适用哪些类型?
      

  4.   

    还是不知道哪来的getlength,谁解答一下啊
      

  5.   

    数组什么时候有getlength方法了?
      

  6.   

    是啊,什么地方来的getlength()????
      

  7.   

    呵呵
    数组当然没有getlength()方法了,地球人都知道滴不过有的类是有getLength()方法滴是不是大家都误解了
      

  8.   

    楼上的新人有问题就该帮助撒
    你当初还不是有这个那个问题的啊
    我也查过api确实没有getlength这个属性
      

  9.   

    是没有getlength这个属性,但是有这个方法啊!我看不常用吧!我也查过api了。
      

  10.   

    public class Test1 {
        public static void main(String[] args) {
           int[] arr = {1, 2, 3};
           System.out.println(arr.length);
           System.out.println(java.lang.reflect.Array.getLength(arr));
        }
    }getLength 方法确实有,但那是一个静态的本机方法,应该不是让开发者拿来用的。当它不存在可能更好些。
      

  11.   

    public static int getLength(Object array)
                         throws IllegalArgumentException
    Returns the length of the specified array object, as an int. Parameters:
    array - the array 
    Returns:
    the length of the array
      

  12.   

    public static int getLength(Object array)
                         throws IllegalArgumentException
    Returns the length of the specified array object, as an int. Parameters:
    array - the array 
    Returns:
    the length of the array