Java 常用类 String的使用---测试
1 package com.bytezero.stringclass; 2 3 import org.junit.Test; 4 5 /** 6 * 7 * 8 * 9 * @author Bytezero1·zhenglei! Email:420498246@qq.com 10 * create 2021-10-21 21:45 11 */ 12 public class StringExer { 13 14 String str = new String("good"); 15 char[]ch = {'t','e','s','t'}; 16 17 public void change(String str,char ch[]){ 18 str = "test ok"; 19 ch[0] = 'b'; 20 } 21 22 public static void main(String[] args) { 23 StringExer ex = new StringExer(); 24 ex.change(ex.str, ex.ch); 25 System.out.println(ex.str + "and"); // goodand 26 System.out.println(ex.ch); //best 27 } 28 29 30 31 32 }
本文来自博客园,作者:Bytezero!,转载请注明原文链接:https://www.cnblogs.com/Bytezero/p/15435454.html