AP CS Notes - StarShipTutor/StarshipTutorAPCS GitHub Wiki
Naming Conventions
Variable Names
- camelCase - thisIsAVariableName, ThisIsAClassName
- Names cannot begin with a number
Doc )
Arrays (int[] theArray; // Declare
theArray = new int[] {21, 22, 23, 24, 25}; // Instantiate
--
int[] theArray = {21, 22, 23, 24, 25}; // Declare & Instantiate
--
int[] theArray = new int [5]; // array of length 5 -- ???
Array Methods
import java.util.Arrays;
-
Arrays have length -- int theLength = array.length;
-
Arrays.equals ( array1, array2 );
-
Arrays.copyOfRange ( array, start, stop );
-
Arrays.toString ( array );
-
Arrays.sort ( array );
-
Arrays.binarySearch ( array, value );