Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class SwapNumbers {
- public static void swap(int a, int b){
- System.out.println("first number: " + a + " second number: " + b);
- a = a + b;
- b = a - b;
- a = a - b;
- System.out.println("After Swappng: first number: " + a + " second number: " + b);
- }
- public static void main(String[] args) {
- int a = 3;
- int b = 5;
- swap(a,b);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement