This code works, but I don't know if this is the best way to do this.
I'm looking for help
1) is it right
2) is there a better way
3) is there a more secure way
/* * James Barber * 12/22/2013 * passing values */ package passing; public class PassingMethods { static int passed1; static int passed2; static int passed3; public static void main(String[] args) { int passing = 10; // printing passing value and the new value System.out.println(passing); passing1(passing); System.out.println("\n" + passed1); passing2(passed1); System.out.println("\n" + passed2); passing3(passed2); } // Receiving value from main, and then passing new value public static void passing1(int passing) { int passed1 = passing + 2; System.out.println(passed1); PassingMethods.passed1 = passed1; } // Receiving new value from 1, and then passing new value public static void passing2(int passed1) { int passed2 = passed1 + 2; System.out.println(passed2); PassingMethods.passed2 = passed2; } // Receiving new value from 2, and then passing new value public static void passing3(int passed2) { int passed3 = passed2 + 2; System.out.println(passed3); PassingMethods.passed3 = passed3; } }// end of class