Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 12.
- An array transferal is when you sequentially process each element of the array, which is useful when printing the individual elements.
- 13.
- for(int i; i < data.length; i++)
- {
- System.out.println("element [" + i + "] is " + data[i]);
- }
- 14.
- [3, 24, 8, -5, 6, 1]
- 15.
- public static void pikachu(int[] list)
- {
- if (list.length == 0)
- {
- System.out.println("[]");
- }
- else {
- System.out.print("[" + list[list.length - 1]);
- for (int i = list.length - 2; i >= 0; i--)
- {
- System.out.print(", " + list[i]);
- }
- System.out.println("]");
- }
- }
- 16. Change occurences of == to an equals method
- 17.
- public static boolean allL(int[] list1, int[] list2)
- {
- if (list1.length != list2.length)
- {
- return false;
- }
- for (int i = 0; i < list1.length; i++)
- {
- if (list1[i] >= list2[i])
- {
- return false;
- }
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment