Strings are an incredibly common
type of data in computers.
A Java string is a series of characters gathered together, like the word "Hello", or the phrase "practice makes perfect". Create a string in the code by writing its chars out between double quotes.
String Class:
A Java string is a series of characters gathered together, like the word "Hello", or the phrase "practice makes perfect". Create a string in the code by writing its chars out between double quotes.
Java String Class is immutable, i.e. Strings in java, once created and initialized, cannot be changed on thesame reference. A java.lang.String class is final which implies no class and
extend it. The java.lang.String class differs from other classes, one difference being that the String objects can be
used with the += and + operators for concatenation.
Two useful methods for String objects are equals( ) and substring( ).
The equals( ) method is used for
testing whether two Strings contain the same value. The substring( ) method is used to obtain
a selected portion of a String.
String Class:
- The
String class is immutable.
- The
contents of the String object can not be changed.
- String
class is final class. That implies it can not have sub classes.
- String
objects can be concatenated by using + and += operators






0 comments:
Post a Comment