Object Oriented Java (Codecademy Cheatsheets) Flashcards
Java objects’ state and behaviour
Instances of classes are called objects.
Object states are in the form of instance fields.
Object behavior is in the form of methods.
What is the dot notation in Java?
The dot is used to access variables and methods of an object or class.
Structure: instanceOrClassName.fieldOrMethodName
What is the constructor method in Java?
Java classes contain a contractor method which is used to create instances of the class.
If no constructor is defined, a default empty constructor is used.
What are reference data types?
A variable with a reference data type has a value that references the memory address of an instance. During variable declaration, the class name is used as the variable’s type
What are constructor signatures?
A class can have multiple constructors so long as they have different parameter values. A signature helps the compiler differentiate between the different constructors.
A signature is made of the constructor’s name and a list of its parameters.
What are nested conditional statements?
These are conditional statements placed inside other conditional statements. The outer one is evaluated first. Depending on the result, the inner conditional statement is either evaluated or not.
What is the NOT operator?
Represented by “!”, this operator negates the value of a boolean expression.
What is the AND logical operator?
Represented by “&&”, this operator returns true if the boolean expressions on both sides of the operator are true, otherwise it returns false.
What is the OR operator?
Represented by “||”, returns true if at least one of the boolean expressions being compared has a true value , otherwise it returns false.
What is the order of operations of conditional operators?
Expression in paranthesis—NOT—AND— OR.