Chapter 3 Flashcards

1
Q

Abstraction

A

The ability to ignore details of parts to focus attention on a higher level of a problem

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

modularization

A

Process of dividing a whole into well-defined parts which can be built and examined separately, and which interact in well defined ways

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Classes define ___

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the 2 types in Java?

A

primitive and object types

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Primitive type

A
  • stored directly in variable
  • non-object type
  • Types suchas int, boolean, char, ­double, and long are the most common primitive types.
  • Primitive types have no methods.
  • pre-defined in the java language
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

object types

A
  • not stored directly in variable but the reference of the object is stored (object references)
  • defined by classes
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Internal method call

A
  • no variable name required
  • method is in the same class as the call of the method
  • syntax:
    methodName(parameter-list)
    ie.
    updateDisplay();
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

External method call

A
  • method call to a method of another object using dot notation
  • syntax:
    object.methodName(parameter-list)
    ie.
    minutes.increment();
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

object.methodName(parameter-list)
this syntax is know as___

A

dot notation:
It consists of an object name, a dot, the method name, and parameters for the call

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

name overloading

A
  • the same name being used for 2 different entities.
  • a class may contain more than one constructor, or more than one method of the same name, as long as each has a distinctive set of parameter types
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What keyword is used in the case of name overloading to refer to the field instead of the closest parameter?

A

“this” such as:
this.from

“this” refers to current object so this particular “this” refers to the “from” field in the current object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

class diagram

A
  • shows the classes of an application and the relationships b/t them
  • gives info about the source code
  • presents static view of a program
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

object diagram

A
  • shows the objects and their relationships at one moment in time during the execution of an application
  • gives info about objects at runtime and presents the dynamic view of a program
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

&&

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are the 3 most important logical operators?

A

and, or and not

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

II

A

“or” logical operator,
“a II b” is true if either a or b or both are true - false if they are both false

17
Q

!

A

“not” logical operator
- “! a” is true if a is false and false if a is true

18
Q

What would happen if one of the operands of a plus operation is a string and the other is not? as in :
“answer: “ + 42

A

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”

19
Q

What would be the result of this concatenation?
“Java” + “with BlueJ”

A

“Javawith BlueJ”
note: if you want a space, include it within one of the strings.

20
Q

What would the result of this be?
return “” + value;

A

“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.

21
Q

Object creation

A
  • objects can create other objects, using the new operator
  • syntax:
    new ClassName (parameter-list)
  • new operation:
    1. creates a new object of the named class
    2. executes the constructor of that class
22
Q

debugger

A
  • A software tool that helps in examining how an application executes.
  • can be used to find bugs
23
Q

Breakpoint

A
  • A flag attached to a line of source code that will stop the execution of a method at that point when it is reached.
  • represented in the BlueJ editor as a small stop sign
24
Q

Primitive vs object types

A

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