SHARE
TWEET

PruebaParametrosValorApp.java

apuntesdejava May 6th, 2013 31,703 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top