Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class SwapExample
- {
- private static void swap(Object a, Object b)
- {
- Object temp = a;
- a = b;
- b = temp;
- }
- public static void main(String[] args)
- {
- Integer a = 5;
- Integer b = 10;
- swap(a, b);
- System.out.println("a: " + a + "\nb: " + b);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement