//StringBuffer :memory saving , stringfaster than.
public class Str01 {
public static void main(String[] args) {
StringBuilder s1 =new StringBuilder("Test");
StringBuilder s2 =new StringBuilder("ABCD");
s1.append(s2); //add
System.out.println(s1);
System.out.println(s2);
s1.append(10); //add
System.out.println(s1);
String s3 =new String("1234");
StringBuffer s4 = new StringBuffer(s3);
System.out.println(s4);
//Method and Description
//StringBuffer space is automatically allocated.
StringBuffer k1 =new StringBuffer(); //() only inputtingcase
// -> basic 16 string creates.
// -> basic 16 string creates.
System.out.println(k1.length()); //()=use spaceX
System.out.println(k1.capacity()); //16 string count space allocated.
k1.insert(0,"ABCD"); //0addressonwards: "ABCD" insert it
System.out.println(k1.length()); // k1.insert->4 string count output
System.out.println(k1.capacity()); // 16 string count space allocated.
k1.insert(0,"12345678901123344"); // 0addressonwards: "12345678901123344" insert it
System.out.println(k1.length()); // k1.insert->use string count output
System.out.println(k1.capacity()); // 34 string count space (autoexpand)
//definition actual use othercase
StringBuffer k2 =new StringBuffer(5); //5 definition
k2.append("123456"); //actually 6
System.out.println(k2.length());
System.out.println(k2.capacity()); //6 multiple form add allocation
//string
StringBuffer k3 =new StringBuffer("ABCD");
System.out.println(k3.length());
System.out.println(k3.capacity()); //6 multiple form add allocation
//object
StringBuffer k4 =new StringBuffer(new String("xyz"));
// use needednone case referencevariable immediately valuestore
// use needednone case referencevariable immediately valuestore
System.out.println(k4.length());
System.out.println(k4.capacity());
k4.append(10.7);
System.out.println(k4);
System.out.println(k4.charAt(2));
System.out.println(k4.indexOf("10"));
k4.insert(4,"_add_"); // position insert
System.out.println(k4);
System.out.println(k4.toString());
k4.reverse(); //reverse
System.out.println(k4);
k4.setLength(5); //forcibly size adjust
System.out.println(k4);
System.out.println(k4.substring(2)); //specify position "after"only output
System.out.println(k4); //value itself changed .
System.out.println(k4.substring(2,4)); //specify position output
StringBuffer k5 =new StringBuffer(" 12345 7");//store to .
System.out.println(k5);
//System.out.println(k5.trimToSize());//->void:value .(meansof)
k5.trimToSize();
System.out.println(k5); // ? ? of needed
StringBuffer str1= new StringBuffer("Hello, JAVA");
StringBuffer str2= new StringBuffer("notllo, Java");
System.out.println("1 :"+str1);
System.out.println("1 size :"+str1.length());
System.out.println("1 :"+str1.capacity());
System.out.println("2 :"+str2);
System.out.println("2 size :"+str2.length());
System.out.println("2 :"+str2.capacity());
//comparison
String st1 = " ";
String st2 = "for ";
st1 = st1 + st2;
System.out.println(st1);
//=on
StringBuffer st3 = new StringBuffer(" ");
st3.append("for ");
System.out.println(s3);
}
}
- Open in Google Docs Viewer
- Open link in new tab
- Open link in new window
- Open link in new incognito window
- Download file
- Copy link address
- Edit PDF File on PDFescape.com
element
| Font | |
|---|---|
| font-family | |
| font-size | |
| font-style | |
| font-variant | |
| font-weight | |
| letter-spacing | |
| line-height | |
| text-decoration | |
| text-align | |
| text-indent | |
| text-transform | |
| white-space | |
| word-spacing | |
| color | |
| Background | |
| bg-attachment | |
| bg-color | |
| bg-image | |
| bg-position | |
| bg-repeat | |
| Box | |
| width | |
| height | |
| border-top | |
| border-right | |
| border-bottom | |
| border-left | |
| margin | |
| padding | |
| max-height | |
| min-height | |
| max-width | |
| min-width | |
| outline-color | |
| outline-style | |
| outline-width | |
| Positioning | |
| position | |
| top | |
| bottom | |
| right | |
| left | |
| float | |
| display | |
| clear | |
| z-index | |
| List | |
| list-style-image | |
| list-style-type | |
| list-style-position | |
| Table | |
| vertical-align | |
| border-collapse | |
| border-spacing | |
| caption-side | |
| empty-cells | |
| table-layout | |
| Effects | |
| text-shadow | |
| -webkit-box-shadow | |
| border-radius | |
| Other | |
| overflow | |
| cursor | |
| visibility |
