Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class PruebaParametrosValorApp {
- public static void main(String[] args) {
- int a = 10, b = 20, c = 30; //declaro y asigno valores
- System.out.println("Valores antes de cambiar");
- System.out.format("a=%d, b=%d, c=%d\n", a, b, c); //imprime a=10, b=20, c=30
- cambiandoValores(a, b, c); //cambia de valores
- System.out.println("Valores despuรฉs de cambiar");
- System.out.format("a=%d, b=%d, c=%d\n", a, b, c); //imprime a=10, b=20, c=30
- }
- private static void cambiandoValores(int a, int b, int c) {
- a = 100;
- b = 200;
- c = 300;
- System.out.println("Valores cambiados en el mรฉtodo");
- System.out.format("a=%d, b=%d, c=%d\n", a, b, c); //imprime a=20, b=30, c=10
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement