package com.daxing_01;
public class StringBuiderDemo02 {
public static void main(String[] args) {
//StringBuilder转化为String
StringBuilder st = new StringBuilder();
st.append("hello");
String s = st.toString();
System.out.println(s);
//String转化为StringBuilder
String r="hello";
StringBuilder sb = new StringBuilder(r);
System.out.println(sb);
}
}
输出:
hello
hello
Process finished with exit code 0