笔试小总结
- Arraylist里面存储默认是Object的,不能直接赋值给String类型的变量,需要强转。
- 值传递和引用传递
class Test { String str = new String("hello"); char[] ch = {'a', 'b', 'c'}; public static void main(String[] args) { //System.out.println(Math.pow('a',2));//9409 Test test = new Test(); test.change(test.str, test.ch); System.out.println(test.str + " and"); System.out.println(test.ch); } public void change(String str, char[] ch) { str = "test ok"; ch[0] = '啦'; //char[] chars = {'a'}; //ch = chars; } }
本文来自博客园,作者:紫英626,转载请注明原文链接:https://www.cnblogs.com/recorderM/p/16065362.html