Homework TOC

total score: 4.65/5

Week # CB Topics Score
Week 10 06 Arrays Unit 6: 0.75/1
Week 14 07 ArrayList Unit 7: 0.95/1
Week 15 08 2D Array Unit 8: 0.95/1
Week 16 09 Inheritance
10 Recursion (I taught and did hacks)
Link to lesson
Unit 9: 1/1
Unit 10: 1/1

What is an array

  • data structure that collects data
  • not an array list
  • data can be primitive or referenced


Parts of array

  • element - one values
  • index the postition of that value


Arary Syntax

  • declare an array variable
  • int[] array = {1,2,3,4,5};


Bound Errors

  • accessing an array element that does not exist


Uninitalized and Unfilled Arrays

  • assign an array variable but not the whole array
  • array variables are similar to object variables


Traverse an Array

  • accessing the valiables inside of the array
  • using iteration or loops or recursion
  • basic for loop: for(int loop = 0; i < values.length; i++)
  • enhanced for loop: for(int element: values)


Developing algorithmns using arrays

  • finding minormax, finding sums, checking for duplicates, sorting

Unit 7 ArrayList

  • Can change size
  • A class with many methods
  • Not designed to store primitives, they store object references
  • Slightly slower than arrays
    7.1 Introduction to ArrayList
  • Primitive Data Types: -Boolean
  • Char
  • Double
  • Int
  • Wrapper Class Data Types
  • Boolean
  • Character
  • Double
  • Integer

2D Array Vocab

Arrays: a data structure used to implement a collection (list) of primitive or object reference data

Element: a single value in the array

Index: the position of the element in the array (it starts from 0)

Array length: the number of elements in the array (public and final)

Protected: an access modifier so that the attribute isn't affected by access modifier that isn't affected by outside modifiers

If the attributes of the subclass are exactly the same as the attributes of the superclass, then we can just use the constructor of the superclass.

An additional attribute that's added to the subclass class does not have to be added to the superclass if it does not apply to it

Overriding methods allows the subclass to provide specific implementation of a method

Has to be already provided by the super-class

If a method in a subclass has the same name, same parameters or signature, and same return type as a method in its super-class, then the method in the subclass will override the method in the super-class.

Uses of the super keyword

Use constructors in the superclass

Use the methods in the superclass in the child class

You can use a inheritance hierarchy to organize references

Polymorphism: You can do one action many ways

Runtime Polymorphism: method overriding

Compile Time Polymorphism: also using method overrloading

Object class is the superclass of all other classes in Java

toString Method: Prints out the attributes of an object and converts a string object to string

equals Method: Compares two strings and returns a boolean value of true if equal