Package class.member;
public class Main {
public static void Main (string[] args) {
Member me = new Member (); Create a Loyalty Object
Mo mo = new Mo (); Create a Member Action object
Mo.mo (Me); Invoke the input method of the member operation object and pass the member object to the Member action object
SYSTEM.OUT.PRINTLN ("\n* * * * member List * * * * * *");
System.out.println ("\n\t number \t\t points");
Mo.member (Me); Call the output method in MO to pass the member object to it
SYSTEM.OUT.PRINTLN ("\n* * * * * * * * * * * * * * * *)
}
}
Package class.member;
Import Java.util.Scanner;
/*
* Membership Category
*/
public class Member {
int number; Number
int integral; Integral
}
Package class.member;
Import Java.util.Scanner;
/*
* Member Action Class
*/
public class Mo {
public void MO (Member me) {&N bsp; //Input Method next member (Member) object name me (passed in the Main method)
Scanner input = new Scanner (system.in); //Creating keyboard Input Objects
System.out.print ("member Number:"); //Enter the number of the member to the Me object
Me.number = Input.nextint ();
System.out.print ("Member points:"); // Enter loyalty points to the Me object integral
me.integral = Input.nextint ();
}
In fact here detours to see the above input with the output below, but in different methods is not the same, it is passed through (Member me), and then by the Main method call
public void member (member me) {//Output input membership number and integral method by a member (Member) object name is me (passed in the Main method).
System.out.println ("\ T" +me.number+ "\t\t" +me.integral);
}
}
Java Simple Object passing