- package com.exam;
- public class test {
- /**
- * @param args
- */
- public static void main(String[] args) {
- student s1=new student();
- System.out.println(s1.s);
- s1.Change(s1.s);
- System.out.println(s1.s);
-
- }
- }
- class student
- {
- String s=new String("未变前");
- void Change(String s){
- s="变了后";
- }
-
- }
复制代码 打印结果:两次都是”未变前“
为什么没有变 |
|