请问是对是错?????
1.StringBuffer的问题讨论?
A:StringBuffer使用字符数据组char[]保存数据
B:使用StringBuffer可以提高字符串查找的速度
C:使用StringBuffer可以提高字符串相加的速度
另外:
2.java中参数传递??
A:所有的参数都是通过引用传递到方法中
B:原始数据类型都是通过值传递到方法中
C:数组都是通过值传递到方法中
D:对象类型都是通过引用传递到方法中
E:对象类型都是通过值传递到方法中
1.StringBuffer的问题讨论?
A:StringBuffer使用字符数据组char[]保存数据
B:使用StringBuffer可以提高字符串查找的速度
C:使用StringBuffer可以提高字符串相加的速度
另外:
2.java中参数传递??
A:所有的参数都是通过引用传递到方法中
B:原始数据类型都是通过值传递到方法中
C:数组都是通过值传递到方法中
D:对象类型都是通过引用传递到方法中
E:对象类型都是通过值传递到方法中
错误,理由如下:
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
A和D对,这两道题目,第一个应该是单选,第二个应该是多选。
你拿的是面试题目吧?
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);
}
}