The pass value in Java and the passover.

xiaoxiao2021-03-06  68

//: c03: assignment.java// assignment with objects is a bit tricky.// from 'Thinking in java, 3rd Ed.' (c) Bruce Eckel 2002 // www.bruceeckel.com. See Copyright Notice In Copyright. TXT. / / EDIT BY NX.

Class Number {INT I;

Public class assignment {public static void main (string [] args) {Number n1 = new number (); Number N2 = new number (); n1.i = 9; n2.i = 47; system.out.println (" 1: n1.i = " n1.i ", n2.i = " n2.i); N1 = N2; System.out.Println (" 2: n1.i = " n1.i ", N2.i = " n2.i); n1.i = 27; System.out.Println (" 3: n1.i = " n1.i ", n2.i = " n2.i);} }

Run: 1: n1.i = 9, n2.i = 472: n1.i = 47, n2.i = 473: n1.i = 27, n2.i = 27

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

New Post(0)