Hello! In this episode we're going to see a new type, which is the type "String". This type let's us define variables corresponding to a sequence of characters. Declaring such a variable is done as usual: I begin by the name of the type, which is "String", followed by the name of the variable that we are declaring, ending with a semi-colon. For example, if I make this declaration, I declare a variable of type "String" named "unNom" [means "someName"] and which is not initialized yet. In this declaration and initialization, I declare a second variable also of type String, named "Message" and which I can represent like this... So be careful, the quotation marks here aren't part of the sequence of characters, they just allow to define the beginning and the end of the sequence. So my variable Message contains a reference to the memory where my sequence of characters "Bonjour tout le monde" is stored. The characters that make up the sequence of characters have their own type, which is the type "char", that means that I can declare variables of type "char" which will contain one single character each. For example, I declare a variable c1 of type "char" and which will contain the character "m". So, please note that to delimit the character, we use this time what are called simple quotes, whereas to delimit a sequence of characters, for example the sequence "mémoire", we use quotation marks, also called "double quotes". A good mnemonic to remember the difference between the two is that for a unique character we use simple quotes, for a sequence of characters which contains generally several characters, we use the double quotes. As for the arrays, a variable of type String contains a reference to a sequence of characters. The semantic use of the operators = and == is then the same as with arrays. For example, here I declare a variable "chaîne" which contains a reference to the empty String; here I declare a variable "chaine2" which contains a reference to the String "foo". When I do this operation, this instruction, I assign the value of chaine2 to the variable chaine, chaine2 contains a reference to "foo", so I am copying this reference in my variable chaine, the reference to the empty String is lost, as it is overwritten by this new reference, and "chaine" also points to "foo". Now, if I do "if (chaine == chaine2)", well this condition is true, as "chaine" and "chaine2" contain the same reference, both to "foo". The String literals occupy the same unique memory addresses, which is called the "String pool" or "String literal pool". For example, when I do this declaration and initialization, I declare chaine1 which will contain a reference to "foo". In fact, this "foo" String will be put in the String literal pool and when I do this second declaration and initialzazion, chaine2 will also be initialized to the "foo" String and it's this same reference, this same "foo" String that will be used. Therefore, chaine1 and chaine2 will contain the same reference, that means that when I use this condition chaine1 == chaine2, this condition is true. Now let's move on to the printing of a String type variable. I declare and initialize here a variable named "chaine" with the sequence of characters "Welcome"; "chaine" contains therefore a reference to "Welcome". Now when I call the function "print" and pass it "chaine", I am entitled to expect that "print" prints what is contained in "chaine", that is the reference to the memory where is effectively stored the sequence of characters "Welcome". Well that isn't the case and "print" indeed prints "Welcome". At this stage of your learning, we can consider this as an exception for Strings as opposed to other non-primitive types. But it's a useful exception, as when we print a sequence of characters, we want to print the sequence of characters rather than the reference to that sequence. We can concatenate a sequence of characters, that is put them end to end, by using the "+" sign. In this example chaine1 and chaine2 are variables of type "sequence of characters", and chaine1 + chaine2 is a new sequence of characters made of chaine1 followed by the characters of chaine2. For example, here I declare a variable named "nom" of type "sequence of characters", and here a variable "prenom". ["prénom" means "firstName"] Let's suppose that I have put a value for "nom", for example "Dupont", and for "prenom", another value, "Jean" [means "John"]. In this assignment here, I begin by doing this first concatenation , that is I put together "Dupont", and this sequence of characters, that is formed of a single space. So for the moment I get a sequence of characters that is "Dupont" followed by the space character, and with this String, I am going to concatenate once again, by adding the value of "prénom", that is "Jean", to it. All this constitutes a new sequence of characters. As I am going to assign the result to my variable "nom", "nom" will contain a reference to that new sequence of characters, and that reference will be lost. So be careful, concatenation never modifies the concatenated Strings. It makes a copy of the Strings into another memory location. That's what we can see on this diagram: "Dupont" hasn't been modified. The following combinations are possible for concatenating two Strings. I can simply concatenate two variables of String type, but I can also begin with a variable of String type followed by a variable of a basic type, that is "int", "double", "char", etc. Or the inverse: begin with a variable of one of the basic types "int", "double". "char", etc. followed by a String-type variable. If I take the previous example, I had used a sequence of characters to insert a space between "nom" and "prénom", we could recognize that it was a sequence of characters because I used quotation marks which are also called "double quotes", but I can also use a simple character, that's what we see with this combination. So in this example I'll use this time a single character that is recognizable by the fact that I'm using simple quotes. This assignment will do the exact same thing as the previous one. A concatenation of the form "String + char" is a very useful way to add a character at the end of a String, In the same way, the concatenation "char + String" let us add a character at the beginning of a String. Let's take this example, where we declare a variable "reponse" that will contain a reference to the String "solution" and let's suppose that I want to change "solution" to the plural form if a variable "n" is greater than 1. I'll do the test and here I'll do a concatenation. "reponse" still has the value "solution", and with the concatenation I'll add "s" to it, and I'll put the result in my variable "reponse". Therefore, "reponse" will now contain a reference to the result of the concatenation, and this link will be lost. So here we are! That's the end of this first video about Strings. In the next episode, we'll focus essentially on the comparison of sequence of characters.