The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

plau (4) [Avatar] Offline
#1
Hello,

in the chapter 4.2.2., there are four StringBuilder class constructors listed, including one that takes another StringBuilder as a parameter. I couldn't find such constructor neither in JRE source code nor in the documentation here: http://docs.oracle.com/javase/7/docs/api/java/lang/StringBuilder.html . Am I missing something obvious or is this an error perhaps?

King Regards,
Plau

Message was edited by:
plau
mala.gupta (245) [Avatar] Offline
#2
Re: [4.2.2.][StringBuilder constructor]
The class StringBuilder implements interface CharSequence:

public final class StringBuilder
extends Object
implements Serializable, CharSequence { /* .. */ }

This class defines a constructor that accepts a CharSequence:

StringBuilder(CharSequence seq)

So you can instantiate StringBuilder, by passing it another StringBuilder instance.

Good Luck to you for your exam.

With respect,
Mala
plau (4) [Avatar] Offline
#3
Re: [4.2.2.][StringBuilder constructor]
Oh, I see. Thank you very much!

Kind regards,
Plau