Thoughts of beginners (the method of passing the parameters)

xiaoxiao2021-03-06  39

//cscd.javaclass cs {int A; int b; cs (int I, int j) {a = i; b = j;} CS (cs o) {o.a = 10; o.b = 10;} }

Class CSCD {public static void main (string args []) {INT i = 10, j = 20; system.out.println ("i and j: i " j); // Parameter passing I and J value cs myob = new CS (i, j); // Press value transmission method system.out.println ("Myob A and B:" myob.a "" myob.b); system.out.println ("I and J:" i "" J); // Parameter passed the value of I and J CS myob1 = new cs (myob); // Press System.out.Println by reference ("Myob A and B : " myob.a " myob.b); // Transfer after the value changes system.out.println ("MyOb1 a NAD B: MyOb1.a " myob1.b);}}

转载请注明原文地址:https://www.9cbs.com/read-63745.html

New Post(0)