String类型传递是值传递,char[]类型传递是引用传递
来源:互联网 发布:麦淘网源码 编辑:程序博客网 时间:2024/06/05 02:24
package com.lstc.test;public class TestDemo3 {String str = new String("hello");char[] ch = { 'a', 'b' };public static void main(String[] args) {TestDemo3 t = new TestDemo3();t.change(t.str, t.ch);//String是封装类,是值传递,char数组是引用传递System.out.println(t.str + " and " + t.ch[0] + t.ch[1]);}public void change(String str, char[] ch) {str = "test ok";ch[0] = 'c';}}
结果是:str任然是hello,ch的第一个元素a变为c
0 0
- String类型传递是值传递,char[]类型传递是引用传递
- Java中,String类型和包装类型作为参数传递时,是属于值传递还是引用传递呢?
- C#中string和Object类型是引用传递
- C#中string是值传递还是引用传递?
- Java-String 到底是值传递还是引用传递
- 关于String是值传递还是引用传递?
- c#中形参是引用类型但依然是值传递!!
- java是值传递,还是引用传递?
- java是值传递还是引用传递?
- java是值传递还是引用传递
- java 是值传递还是引用传递
- java是值传递还是引用传递。
- Python是值传递?引用传递?
- java是值传递还是引用传递
- JAVA是值传递还是引用传递
- java是值传递还是引用传递?
- Java 是值传递还是 引用传递?
- JAVA是引用传递还是值传递
- 筛选素数
- .NET基础--字段与属性的区别
- WPF:如何在工作线程中更新窗体的UI元素(Dispatcher机制)
- Shiro登录机制验证,自定义FormAuthenticationFilter
- Java与C#的区别
- String类型传递是值传递,char[]类型传递是引用传递
- URL传递中文乱码问题
- 子树判断
- ISO C++ forbids declaration of ‘Contack’ with no type [-fpermissive]
- SubClassWindow详解
- HelloJSP!——pageContext对象
- 动画animation
- IOS学的容易--XML的SAX解析
- 各种编程语言的深度学习库整理