public class StringBuilder_IN {
public static void main(String args[]) {
String myString = "How";
StringBuilder myStrBldr = new StringBuilder("How");
myString += " now";
myString += " Brown";
myString += " Cow?";
myStrBldr.append(" now");
myStrBldr.append(" Brown");
myStrBldr.append(" Cow?");
System.out.println("String= " + myString);
System.out.println("StringBuilder= " + myStrBldr);
}
}
public static void main(String args[]) {
String myString = "How";
StringBuilder myStrBldr = new StringBuilder("How");
myString += " now";
myString += " Brown";
myString += " Cow?";
myStrBldr.append(" now");
myStrBldr.append(" Brown");
myStrBldr.append(" Cow?");
System.out.println("String= " + myString);
System.out.println("StringBuilder= " + myStrBldr);
}
}
No comments:
Post a Comment