StringBufferTest
This commit is contained in:
parent
c090a72264
commit
7cdb9c6d2d
26
src/main/java/com/zeekling/string/StringBufferTest.java
Normal file
26
src/main/java/com/zeekling/string/StringBufferTest.java
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package com.zeekling.string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zeekling
|
||||||
|
* @apiNote https://www.nowcoder.com/question/next?pid=30796423&qid=15076&tid=44509101
|
||||||
|
* @since 2021-05-23
|
||||||
|
*/
|
||||||
|
public class StringBufferTest {
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
StringBuffer a = new StringBuffer("A");
|
||||||
|
|
||||||
|
StringBuffer b = new StringBuffer("B");
|
||||||
|
|
||||||
|
operate(a, b);
|
||||||
|
|
||||||
|
System.out.println(a + "." + b);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void operate(StringBuffer x, StringBuffer y) {
|
||||||
|
x.append(y);
|
||||||
|
y = x;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user