String In Java

31 Shares

String In Java:

A string may be defined as a group of character an array of a character written in a double quart. It is used to store multiple characters in a single name.

There is the following type of string in java:
  • String
  • String Buffer
  • String Builder
  • String Tokenizer

String:-

A string is the predefined class of java. Every string is an object of predefines class String that is used to store or represent the string data enclosed within double quart. It is used to store multiple characters in a single name. It is immutable in nature that is once created its size of content cannot be modified.

Creation of the string:

  1. String < String name >= new string ()

It will create an empty string and initialized it with the data only once.

Example:-

      2. String < String Name > = new string (“ string data “)

It will create the string and initialized it with the given string data.

Example:-

     3. String < String name >= new string ( string object )

It will create the string and initialized it with the given string object.

Example:-

4. String < String > = new string ( Array of character)

The string can be created from an array of character.

Example:-

      5. String < String name > = new string ( Array of byte )

The string can be created from an array of byte.

31 Shares

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.