Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Daniel Lawson 10/4/2016
- 2.
- numbers[0] first element , numbers[9] last element if it is 10 long,numbers[numbers.length-1] last element no matter the length
- 4.
- int max = 38;
- int min = -7;
- int[] odd = new int[Math.abs(max - min+2)/2 ];
- for(int i = 0;i<odd.length;i++){
- odd[i] = min + i*2;
- }
- System.out.println(Arrays.toString(odd));
- 6.
- 0 = 3, 1 = 3, 2 3 4 = 6, 5 = 9 6 7 = -18, the array = [3,3,0,0,6,9,0,-18]
- 8.
- a. int[] a = {17,-3,42,5,9,28};
- 10.
- public static int max(int[] array){
- int max = 0;
- for(int i = 0;i<array.length;i++){
- if(array[i] > max)max = array[i];
- }
- return max;
- }
- 12.
- traversing an arrary is manipulating an array using for loops , an example of this is the max method created in the last problem.
- 14.
- the arrary contains 3, 24, 8, -5, 6, 1
- 16.
- for count change the int[] list into String[] list ,change target to a char, and then have another for loop inside hte for each loop saying for(int i = 0; i < list[n].length();i++) if list[n].charAt(i) = target count++;
- for equals change the type of list1, list 2 to String, also chang ethe if statement in the second forloop to !list1[i].equals(list2[i])
Advertisement
Add Comment
Please, Sign In to add comment