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 }

 

posted on 2021-10-21 22:07  Bytezero!  阅读(44)  评论(0编辑  收藏  举报