

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


public class Swap{ private int a; public Swap( int a ){ }this.a = a; public void swap( int a, int b ){ int tmp; tmp = a;a = b; }b = tmp; public void swap( Swap ref ){ int tmp; tmp = this.a;this.a = ref.a; }ref.a = tmp; public static void swap( Swap ref1, Swap ref2 ){ Swap tmp; tmp = ref1;ref1 = ref2; }ref2 = tmp; public static void main( String[] args ){ int a = 11;int b = 22; Swap ref1;Swap ref2; ref1 = new Swap(9);ref2 = new Swap(3); Swap.swap( ref1, ref2 );System.out.println( ref1.a ); System.out.println( ref2.a ); ref1 = new Swap(9);ref2 = new Swap(3); ref1.swap( a, b );System.out.println( a ); System.out.println( b ); ref1 = new Swap(9);ref2 = new Swap(3); ref1.swap( ref2 );System.out.println( ref1.a ); }System.out.println( ref2.a ); }
Boolean[] b = new Boolean[3]; __________ double[] d = new double[4]; __________ int[] a = new int[5]; __________ boolean[] c = new boolean[7]; __________
int[] a = { 1, 1, 2, 3, 5, 8, ... }; // You do not know how many values are in the initializer list
for ( int i = ___________ ; i < ___________ ; ___________ ) System.out.println( ___________ );
___________ ( int i ___________ ___________ ) System.out.println( ___________ );
while{ ( ___________________ )
} _______________________________________________