Assignment#5 - Sanasehar220/java-learning- GitHub Wiki
String class:
It is widely used in java programing,are a sequence of character.In java programming language string is object.The java plateform provides the string class to create and manipulate string. String class is immutable,so that once it is created a string object can not be changed.
String Method:
String class has a number of methods and these are: 1:char charAt(int index) Returns the char value at the specified index. 2: String concat(String str) Concatenates the specified string to the end of this string 3:boolean contains(CharSequence s) Returns true if and only if this string contains the specified sequence of char values. 4:byte[] getBytes(String charsetName) Encodes this String into a sequence of bytes using the named charset, storing the result into a new byte array. 5: boolean isEmpty() Returns true if, and only if, length() is 0. 6:int length() Returns the length of this string. 7:boolean startsWith(String prefix) Tests if this string starts with the specified prefix. 8:String toLowerCase() Converts all of the characters in this String to lower case using the rules of the default locale. 9: String toLowerCase(Locale locale) Converts all of the characters in this String to lower case using the rules of the given Locale.
What is immutable object?
In object oriented programing the immutable object is an object whose state can not be modified after it is created.for example long,short,double and character etc are immutable classes in java.
What is mutable object?
An object whose state can be changed after it is created.