Good day steemians, I hope you had a great night? Today we will be talking about a Java class called string.
String
A String class represents character strings Which usually contains a long amount of alphanumeric characters, for example "shade is a girl" This is called a string or an array of characters. Once a string is declared, its vallues cannot be changed.
Java's String class includes methods for examining individual characters of the array, for comparing strings, for searching in between strings, for extracting substrings I.e characters or strings from long strings, and for creating a copy of a string with all characters already converted to uppercase or to lowercase.
How to use String
String name = "My name is official-hord"
When the string class is called, the name you want to give the class should follow and the text to be saved in it across the other side.
To test if you saved a string do this.
String s ="@official-hord "; System.out.Print(s);
Your output should be @official-hord.
Strings as said earlier could be manipulated by adding more to them, or breaking a few out. The process of adding more is called concatenation.
Concatenation
This is the process of combining two or more strings to become one.
We might want to add one or more information to an already existing information so the need for concatenation cannot be escaped.
How To concatenate
String pet = "charlie"; System.out.print(pet);
Output - charlie
Sting pet = pet+"is my pet dog"; System.out.print(pet);
Your output should have Charlie is my pet dog in it.
I hope you have an understanding of what a string is in Java now.
Thanks for reading through, I'm @official-hord the programmer.