Abstraction
The ability to ignore details of parts to focus attention on a higher level of a problem
modularization
Process of dividing a whole into well-defined parts which can be built and examined separately, and which interact in well defined ways
Classes define ___
types. A class name can be used as the type for a variable. Variables that have a class as their type can store objects of that class.
What are the 2 types in Java?
primitive and object types
Primitive type
object types
Internal method call
External method call
object.methodName(parameter-list)
this syntax is know as___
dot notation:
It consists of an object name, a dot, the method name, and parameters for the call
name overloading
What keyword is used in the case of name overloading to refer to the field instead of the closest parameter?
“this” such as:
this.from
“this” refers to current object so this particular “this” refers to the “from” field in the current object.
class diagram
object diagram
&&
Logical “and” operator that causes the condition in the if-statement to be true if both the conditions on either side of the “&&” symbol are true
What are the 3 most important logical operators?
and, or and not
II
“or” logical operator,
“a II b” is true if either a or b or both are true - false if they are both false
!
“not” logical operator
- “! a” is true if a is false and false if a is true
What would happen if one of the operands of a plus operation is a string and the other is not? as in :
“answer: “ + 42
If one of the operands of a plus operation is a string and the other is not, then the other operand is automatically converted to a string, and then a string concatenation is performed.
“answer: 42”
What would be the result of this concatenation?
“Java” + “with BlueJ”
“Javawith BlueJ”
note: if you want a space, include it within one of the strings.
What would the result of this be?
return “” + value;
“value”
If we concatenate “value” with an empty string, it will be converted to a string and no other characters will be prefixed to it.
Object creation
debugger
Breakpoint
Primitive vs object types
Primitive
- predefined
- held in stack
- 2 distinct variables are overrated + 2 separate assignments. Values should be same
- do not null value as default value
- examples: byte, float, double, char, Boolean, etc
Object
- user-defined
- original object kept in the heap & ref variable kept in stack
- 2 ref variables are generated, both highlight similar article on the heap
- ref variable default value is null
- example: array, String etc