//write a method to receive two integer numbers and print the number which is nearer or equal to 20 if both number are more than 20, the method will print 0
public static void main (String [] argv)
{
nearer20 (10, 20); // Output : 20
nearer20 (18, 10); // Output : 18
nearer20 (10, 21); // Output : 10
nearer20 (30, 25); // Output : 0
}
public static void nearer20 (int n1, int n2)
{
continue
//write a method to received two integer arrays and copy the numbers in the first array repeatedly into second array
public static void main (String [] argv)
{
int []sample1 = {1, 2, 3};
int []sample2 = new int [7];
repeatCopy(sample1, sample2);
//sample2 will contain: 1 2 3 1 2 3 1
}
public static void repeatCopy (int [] data1, int[] data2)
Continue
Comments
Leave a comment