
|
final int MAX = 10; int [] sample = {2, 3, 5, 1, 8, 4, 9, -3, 6, 3}; int x; |
| x = sample[0]; |
| x = sample[MAX - 1]; |
| x = sample[3] * sample[5]; |
| x = 2 *sample[2] - 3 * sample[7]; |
| sample[0] = sample[MAX - 1]; sample[MAX - 3] = 7; |
|
int i = 0; sample[i] = sample[i + 1]; |
|
for (int i = 0; i < sample.length; i++) sample[i]++; |
|
for (int i = 0; i < MAX - 2; i++) sample[i] = sample[i + 1]; |
public static void main(String[] args) {
int[] arr = { 1, 2, 3 };
int x = 5;
func(arr, x);
System.out.println(Arrays.toString(arr));
System.out.println(x);
}
public static void func(int[] arr, int x) {
arr[0] = x;
arr[1] = x;
arr[2] = x;
x = 9;
}
public static void main(String[] args) {
int[] arr = { 1, 2, 3 };
int x = 5;
func(arr, x);
System.out.println(Arrays.toString(arr));
System.out.println(x);
}
public static void func(int[] brr, int x) {
brr[0] = x;
}
public static void main(String[] args) {
int[] arr = { 1, 2, 3 };
int x = 5;
func(arr, x);
System.out.println(Arrays.toString(arr));
System.out.println(x);
}
public static void func(int[] brr, int x) {
int [] arr = {2 , 3 , 1};
arr[0] = 7;
brr[0] = x;
}
public static void main(String[] args) {
int[] arr = { 1, 2, 3 };
int x = 5;
arr = func(arr, x);
System.out.println(Arrays.toString(arr));
System.out.println(x);
}
public static int [] func(int[] brr, int x) {
int [] arr = {2 , 3 , 1};
brr[0] = x;
return arr;
}
public static void main(String[] args) {
int[] arr = { 1, 2, 3 };
System.out.println(Arrays.toString(arr));
arr = func(arr);
System.out.println(Arrays.toString(arr));
}
public static int [] func(int[] arr) {
int [] brr = new int [arr.length*2];
int j = 0;
for (int i = 0; i < arr.length; i++){
brr[j] = arr[i];
j++;
brr[j] = arr[i];
j++;
}
return brr;
}
|
int [][] myTable = new int [5][6]; |
|
String [][] dictionary = { {"pumpkin pie", "A dessert served on Thanksgiving"}, {"FF0000", "The HEX 24-bit value equivalent to red"}, {"pencil", "A tool for writing"} }; |