请问是对是错????? 
1.StringBuffer的问题讨论?
A:StringBuffer使用字符数据组char[]保存数据 
B:使用StringBuffer可以提高字符串查找的速度 
C:使用StringBuffer可以提高字符串相加的速度 
另外:
2.java中参数传递??
A:所有的参数都是通过引用传递到方法中
B:原始数据类型都是通过值传递到方法中
C:数组都是通过值传递到方法中
D:对象类型都是通过引用传递到方法中
E:对象类型都是通过值传递到方法中

解决方案 »

  1.   

    A:StringBuffer使用字符数据组char[]保存数据 
    错误,理由如下:
    A thread-safe, mutable sequence of characters. A string buffer is like a String, but can be modified. At any point in time it contains some particular sequence of characters, but the length and content of the sequence can be changed through certain method calls.B:使用StringBuffer可以提高字符串查找的速度 
    不置可否,因为缺少比较对象。C:使用StringBuffer可以提高字符串相加的速度 
    正确,理由如下:
    The principal operations on a StringBuffer are the append and insert methods, which are overloaded so as to accept data of any type. 注上述理由来自DOCS
      

  2.   

    2.java中参数传递??
    A和D对,这两道题目,第一个应该是单选,第二个应该是多选。
    你拿的是面试题目吧?
      

  3.   

    class hello{
             int a = 1;
             void add(int temp){
                 temp++;
             }
             public static void main(String args[]){
                 hello h = new hello();
                 h.add(h.a);
                 System.out.println(h.a);
            }
      }
    你若试试这个例子,就明白了。
    按照你的意思,是这样的。
    class hello{
             int a = 1;
             void add(int temp){
                 temp++;
                 a=temp;
             }
             public static void main(String args[]){
                 hello h = new hello();
                 h.add(h.a);
                 System.out.println(h.a);
            }
      }
      

  4.   

    题本身有问题。第一题问得太模糊了:A. 是对的,因为StringBuffer的内部确实是用char[]来保存的,当char[]长度不够时自动扩充,StringBuffer的内部机制和ArrayList非常相似。B. 就问得有问题了,不知是问从字符串中查找子串呢,还是从一个保存了StringBuffer的容器中查找一个特定的StringBuffer。如果是查找子串,那么与String没有区别,因为都是检索char数组;如果是从容器中查找,那么String要有效得多,因为String重写了hashCode()和equals(),而StringBuffer没有。C. 是对的,因为StringBuffer在append时,只是往内部数组中存放新数据,而不像String相加时,需要创建新的String对象,所以StringBuffer效率更高。
      

  5.   

    第一题上楼Dan1980(有了Eclipse,再也不用记事本编程了,Eclipse真好!-) ( 已经说得很好了第二题 都是值传递只不过类作为参数的时候,是值传递引用。