Variable Types
- Primitives: int, double, boolean ("clock" analogy for overrunning bounds of int)
-
Wrapper classes: Integer, Double, Boolean
Example: Integer myInteger = new Integer( 10 );
Example: Double myDouble = new Double( 3.14 );
Example: Boolean myBoolean = new Boolean( true );
- String
Example: String myName = new String( "Mud" );
Example: String myName = "Mud";
- Arrays
Example: int[ ] myArray = new int[10]; // array of primitives
Example: String[ ] myArray = new String[10]; // array of Objects
- ArrayList
Exampe: ArrayList someArrayList = new ArrayList();
Iteration
- for loop
for( int index = 0; index < someArrayList.size(); index++ )
{
}
for( int index = 0; index < someArray.length; index++ )
{
}
- for each loop ( aka enhanced for )
for( Car c : garageOfCars )
{
System.out.println( c.getName() );
}
- while loop
while( ctr < 100 )
{
ctr++;
}
- Iterator interface
Iterator itr = someArrayList.iterator();
while( itr.hasNext() )
{
String s = itr.next()
if( s.equals( "Java" ) )
{
System.out.println( s );
}
- The classic "for loop removal" problem
Decision-Making
- if statement
- if else statement
- switch statement (not tested)
Classes
- Instance variables
- Methods: getters and setters (or accessors and mutators)
- toString() method
-
Constructors
- Uses of "this" ( this.yourValue and this() )
Inheritance
- Abstract classes
- Interfaces (100% abstract class!)
- Polymorphism
- Reference types: concrete classes, abstract claseses, interfaces
- Uses for super ( super.yourMethod and super() in constructors)
1. Searching and Sorting
Google "searching and sorting simulations" for great graphical simulations of all types of sorts.
MathSite Searching/Sorting Simulations
Big-O Tutorial
- Sequential search
- Binary search
- Selection sort
- Insertion sort
- Mergesort
Here is the mini-project description for the Sorting/Searching Project
Sorting and Searching Mini-Project
Sorting and Searching Mini-Project Rubric
Some Search/Sorting Role Play Picutures
Sort 1 Sort 2 Sort 3
Sort 4 Sort 5 Sort 6
Sort 7 Sort 8 Sort 9
Sort 10 Sort 11 Sort 12
2. Recursion
3. Number System Conversion (dec, bin, hex, oct)
Java Collections
- ArrayList
- Linked Lists
- Stacks/Queues
- Sets (HashSet, TreeSet)
- Maps (HashMap, TreeMap)
- BSTs