fork(1) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. int VarA;
  13. int VarB;
  14. int Aux;
  15.  
  16. System.out.println("Digite a Primeira Variavel");
  17.  
  18. Scanner Lera = new Scanner(System.in);
  19. VarA= Lera.nextInt();
  20.  
  21. System.out.println("Digite a Primeira Variavel");
  22. VarB= Lera.nextInt();
  23.  
  24. System.out.println("O valor de A é: " +VarA);
  25. System.out.println("O valor de B é: " +VarB);
  26.  
  27. Aux=VarA;
  28. VarA=VarB;
  29. VarB=Aux;
  30.  
  31. System.out.println("O novo valor de A é: " +VarA);
  32. System.out.println("O novo valor de B é: " +VarB);
  33. }
  34. }
Success #stdin #stdout 0.12s 29536KB
stdin
5 7
stdout
Digite a Primeira Variavel
Digite a Primeira Variavel
O valor de A é: 5
O valor de B é: 7
O novo valor de A é: 7
O novo valor de B é: 5