Learn Java Programming - StringBuilder Introduction Tutorial

Publié le: 29 septembre 2015
sur la chaîne: Daniel Ross
1,453
17

I am going to produce several tutorials relating to the StringBuilder class. In each of these tutorials I will be comparing similarities and differences to the String class. The String class has all sorts of nuances that I have addressed in my multi-part String tutorials. I recommend watching all of the String related tutorials to get a good feel for the String class capabilities. The most notable difference between the StringBuilder class and the String class is that String class is immutable and the StringBuilder class is mutable.

Object state is a fancy term for describing the values held by instance variables. Immutable means that the object state cannot be modified once it is instantiated. Mutable means that the object state can be modified after it is instantiated.

Immutable state example:
final char objectState[] = { 'H', 'E', 'L', 'L', 'O' };
objectState = new char[] { 'C', 'A', 'T'}; // Illegal! final won't allow objectState to be assigned to another object

Mutable state example:
char objectState[] = { 'H', 'E', 'L', 'L', 'O' };
objectState = new char[] { 'C', 'A', 'T'}; // no problem - object state is now CAT


Sur cette page du site, vous pouvez voir la vidéo en ligne Learn Java Programming - StringBuilder Introduction Tutorial durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Daniel Ross 29 septembre 2015, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 1,453 fois et il a aimé 17 téléspectateurs. Bon visionnage!