Sunday, August 15, 2010

StringBuffer vs. StringBuilder

Courtesy of Sun Web Learning Center

Which two statements comparing java.lang.StringBuilder to java.lang.StringBuffer are true? (Choose two.)


A     Both classes have a lastIndexOf method.
B     Both classes' key methods are synchronized.
C     Only StringBuffer has a lastIndexOf method.
D     Only StringBuilder has a lastIndexOf method.
E     Only StringBuffer's key methods are synchronized.
F     Only StringBuilder's key methods are synchronized.

A and E are correct. You don't have to memorize all of these classes' methods, but you have to know that they share the same methods.

No comments:

Post a Comment