Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. public class PruebaParametrosValorApp {
  2.  
  3.     public static void main(String[] args) {
  4.         int a = 10, b = 20, c = 30;  //declaro y asigno valores
  5.         System.out.println("Valores antes de cambiar");
  6.         System.out.format("a=%d, b=%d, c=%d\n", a, b, c); //imprime a=10, b=20, c=30
  7.         cambiandoValores(a, b, c); //cambia de valores
  8.  
  9.         System.out.println("Valores después de cambiar");
  10.         System.out.format("a=%d, b=%d, c=%d\n", a, b, c); //imprime a=10, b=20, c=30
  11.     }
  12.  
  13.     private static void cambiandoValores(int a, int b, int c) {
  14.         a = 100;
  15.         b = 200;
  16.         c = 300;
  17.         System.out.println("Valores cambiados en el método");
  18.         System.out.format("a=%d, b=%d, c=%d\n", a, b, c); //imprime a=20, b=30, c=10
  19.     }
  20. }