Arrays
- Definition, some array definitions:
public class ArrayDefs {
public static viod main(String[] args) {
//variable start with type followed by []
float x[];
int fib[] = {0, 1, 1, 2, 3, 5};
x = new float[100];
args = new String[10];
//most commonly used
//type variable = new type[size]
boolean isPrime = new boolean[10];
int fib[] = {0, 1, 1, 2, 3, 5};
}
}
Get the length: array.length
Sort the array: Arrays.sort();