- Explore below three classes of java
- String Class
- StringBuffer Class
- StringBuilder Class
Solution :
Code :
package .vscode;
public class Compare_String {
public static void string(String s1) {
S1 = s1 + “OrientedProgram”;
}
public static void stringbuilder(StringBuilder s2) {
S2.append(“OrientedProgram”);
}
public static void stringbuffer(StringBuffer s3) {
S3.append(“OrientedProgram”);
}
public static void main(String[] args) {
String s1 = “Object”;
String(s1);
System.out.println(“String: “ + s1);
StringBuilder s2 = new StringBuilder(“Object”); stringbuilder(s2);
System.out.println(“StringBuilder: “ + s2);
StringBuffer s3 = new StringBuffer(“Object”);
Stringbuffer(s3);
System.out.println(“StringBuffer: “ + s3);
}
}
OUTPUT:
DOWNLOAD PDF HERE........ |
No comments:
Post a Comment