Thursday 12 June 2014

Strings

String is a Collection of characters. Strings are immutable in Java, I.e, their values cannot be changed once they created. To Support mutable strings Java supports StringBuffer and StringBuilder Classes.

String Class in Java provides number of methods like find the length of the string, find Sub string, find character at particular index etc.,

In Java Strings can be created by using literals or by using String Constructors.
String Class provides various constructors to Construct String Objects.
     public String()
     public String(String s)
     public String(char value[])
     public String(char value[], int offset, int count)
     public String(int[] codePoints, int offset, int count)
     public String(byte bytes[], int offset, int length, String charsetName)
     public String(byte bytes[], int offset, int length, Charset charset)
     public String(byte bytes[], String charsetName)
     public String(byte bytes[], Charset charset)
     public String(byte bytes[], int offset, int length)
     public String(byte bytes[])
     public String(StringBuffer buffer)
     public String(StringBuilder builder)


Prevoius                                                 Next                                                 Home

No comments:

Post a Comment