Java OCA OCP Practice Question 968

Question

In the following code fragment, after execution of line 1, sbuf references an instance of the StringBuffer class.

After execution of line 2, sbuf still references the same instance.

1. StringBuffer sbuf = new StringBuffer("abcde"); 
2. sbuf.insert(3, "xyz"); 
  • A. True
  • B. False


A.

Note

The StringBuffer class is mutable.

After execution of line 2, sbuf refers to the same object, although the object has been modified.




PreviousNext

Related