1/17
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
random int between 5 and 10, inclusive
(int)(Math.radom()*6) + 5;
formatting of random
(int)(Math.random()*range) + min
range = max-min +1
private String example;
public Object(String thingy){
??
}
example = thingy
Insertion sort
starts with first item, shifts individual items one at a time
merge sort
halves and then halves and then halves
selection sort
passes through whole thing and puts the lowest at the beginning
iteration search
loops instead of recursion
bubble sort
items 0 and 1 compare then swap, items 1 and two compare and swap… etc
For each loops
int[] nums = new int[];
normal: for(int i = 0; i < nums.length; i++){
}
for each: for(int num: nums){
}
the int before the colon is the same as i, the number after the same as whatever i is less than
nested for each loop
int[][] matrix = new int[][];
for(int row: matrix){
for(int col: row){
}
}
second nested calls the i of the first one
for each loops with arraylist
ArrayList<String> names = new ArrayList<String>();
for(String i: names){
System.out.println(i);
}
no .get and cannot change elements
for each loops with array
String[] names = new String[];
for(i: names){
System.out.println(i);
}
no [ ]
class header
public class Example{
public static void main(String[] args){
final
cannot be changed. ex: final Double pi = 3.14
instance variables/attributes
the class variables, ex:
String place();
super
calls the constructor or parametized constructor from the superclass
public PainterPlus(){
super();
}
escape sequences
\n = new line
\” = double quote
\\ = backslash
De morgans laws
the rules with || && ! with parenthesis