Important Java programs for Aptitude test

Aptitude-java.jpg

1.Store 2 numbers in two variables and swap or exchange them by using 3rd variable class swap1 {     public static void main(String args[])     {     int a=10,b=20,t;     System.out.println(“Before swap: a = ” + a + “, b = ” + b);         t = a;         a = b;         b = t;     System.out.println(“After swap: a = ” + … Read more