fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*; // Stream Ein-/Ausgabe
  4.  
  5. public class Main
  6. {
  7. public static void main (String[] args)
  8. {
  9. int zahl1 = 4;
  10. int zahl2 = 8;
  11. int temp;
  12.  
  13. System.out.print("\tProgramm SWAP in JAVA\n");
  14.  
  15. temp = zahl1;
  16.  
  17. zahl1 = zahl2;
  18.  
  19. zahl2 = temp;
  20.  
  21. System.out.print("\tWert für zahl1:");
  22. System.out.println(" " + zahl1 +"\n");
  23.  
  24. System.out.print("\tWert für zahl2:");
  25. System.out.println(" " + zahl2 +"\n");
  26.  
  27.  
  28. }
  29. }
Success #stdin #stdout 0.09s 320576KB
stdin
33

stdout
	Programm SWAP in JAVA
	Wert für zahl1: 8

	Wert für zahl2: 4