欢迎来到易学考试网 易学考试官网
全部科目 > Java认证考试 > SCJP程序员认证考试

单项选择题

Given this method in a class: 
public String toString() { 
StringBuffer buffer = new StringBuffer(); 
buffer.append(‟<‟); 
buffer.append(this.name); 
buffer.append(‟>‟); 
return buffer.toString(); 
} 
Which is true?() 

    A. This code is NOT thread-safe.
    B. The programmer can replace StringBuffer with StringBuilder with no other changes.
    C. This code will perform well and converting the code to use StringBuilder will not enhance the performance.
    D. This code will perform poorly. For better performance, the code should be rewritten: return “<“+ this.name + “>”;

点击查看答案&解析

相关考题

微信小程序免费搜题
微信扫一扫,加关注免费搜题

微信扫一扫,加关注免费搜题