Some other very important methods in String class in java: setLenth(),length(), append(String), charAt() and setCharAt()
Java String Handling
Some other very important methods in String class in java
1. setLenth() syntax:
void setLength();
Example:
sb.setLength(10);
Sop(sb.length());
2. charAt() and setCharAt() Syntax:
char charAt(int position)
void setCharAt(int position, char ch)
append()
Example:
StringBuffer sb= new StringBuffer(“Heera”);
sb.append(“Babu”);
sop(sb);//Heera Babu