Unit 1-5 Lesson Blogs
Lesson Score + Notes/Tangibles
Unit 1
- wrapper classes for all primitive data types like char, int, double, boolean where you can call in static methods that return values
- primitive wrapper objects or string objects are immutable so the methods can't change
- Boolean, char, int, float, double are all primitive data types
- String, Array, etc. are non-primitive data types
- String class are unable to be changed
- declare a variable that can be accessible and/or changed
- (=) is used to initialize variables or change its associated value
- Operators are + - * / %
- Compound operators are +=, -=, *=, /=, %=
- Increment/decrement ++ or --
Unit 2
- classes are blueprints for creating objects
- objects are instances within a class
- attributes are inherited by objects
- Non static methods are dot operators
- methods are certain set of code that runs a specific task
- overloaded methods give multiple methods the same name with different signatures
- void methods don't return values
- Non void methods return a value of the same type defined in the method signature
- static methods are a part of a class instead of an instance of a class which is why it's in a bracket in the class
Unit 3
- boolean expression is true or false
- If-else statements sets up alternate code if the first expression turns false
- Else-if statements allow for more conditions to be defined
- De Morgan's law: logical operators && (and) ll(or) and !(not)
Unit 4
- While/for loops: repeats lines of code until a specific condition comes out false; can iterate over multiple elements
- For loops are most tested
- Strings: array chairs
Unit 5
- Public classes: no restricted access - constructors
- Private classes: restricted access - instance variables
- Accessor method (getter): allows other objects to obtain values of instance variables or static variables
- Non void methods return a single value
- toString() method is a overridden method that provides description of a specific object
- Mutator Method (setter): void method that changes value of instance variables/static variable
Additional Vocab
Primitives:
- Doubles - 64 bits
- Integers - 32 bits - use int when declaring, not Integer. Integer is non-primitive
- Booleans - 1 bit
- String is a non-primitive data type
Non-primitive or Wrapper classes data types use methods to perform actions
String Class
Strings are immutable - unable to be changed
Methods that act upon string objects do not change the state of the defined string object.
Overloading with Constructors and Methods
Constructors - initialize the attributes for an object
- Constructors start with public, and have the same name as the class. In this case, these constructors are for the class Person
Abstract class: is a restricted class that cannot be used to create objects (to access it, it must be inherited from another class).
Abstract method: can only be used in an abstract class, and it does not have a body. The body is provided by the subclass (inherited from)
Inheritance in Java is the method to create a hierarchy between classes by inheriting from other classes