Chapter 1 - Objects and classes Flashcards

1
Q

when naming these they always begin with a lower case letter

A

what is the convention for naming
objects

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

view link

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

describe a
class

A

is a category or type of something that will have characteristics

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

an object is an instance of a class

A

describe an
instance

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

these include
* byte (1 byte)
* short (2 bytes)
* int (4 bytes)
* long (8 bytes)

A

what are the 4
integer primitive types
and their size in bytes

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

these include
* float (4 bytes)
* double (8 bytes)

A

what are the 2
real number primitive types
and their size in bytes

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

describe in 3 points javas
object type

A
  • these are created by the user
  • when held in a variable only a reference to the original is stored, a copy of the variable will also reference the same original
  • changes made to any reference will be reflected on all references
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

this is the act of converting a smaller type to a larger type size
byte -> short -> char -> int -> long -> float -> double

A

describe
widening casting
and the order of types

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

this is the act of having many instances from a single class. Each instance is an object that can change its state by adjusting the values of its fields

A

describe
multiple instances

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

double myDouble = 9.78d;
int myInt = (int) myDouble; // Manual casting: double to int

A

manually cast a double to an int

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

what is type casting

A

this is when you assign a value of one primitive data type to another type.

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

is a category or type of something that will have characteristics

A

describe a
class

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

manually cast a double to an int

A

double myDouble = 9.78d;
int myInt = (int) myDouble; // Manual casting: double to int

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

describe in 3 points javas
primitive data types

A
  • these are predefined data types of Java. They specify the size and type of any standard values
  • these are not associated with classes and so have no methods
  • when this is declared in a variable it is stored directly, if the variable is copied then another copy is created
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

describe an
object

A

is a specific entity of a class that will have the characteristics of its class but will be specific to this object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q
  • these are created by the user
  • when held in a variable only a reference to the original is stored, a copy of the variable will also reference the same original
  • changes made to any reference will be reflected on all references
A

describe in 3 points javas
object type

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

the car is a class because we cannot answer questions about a particular car
such as
* what colour is the car
* what horse power is the car

A

why is car a class and not an object

18
Q

these include
* char (2 bytes)
* boolean (1 bit)

A

what are the 2
other primitive types
and their size

19
Q

what are the 2
real number primitive types
and their size in bytes

A

these include
* float (4 bytes)
* double (8 bytes)

20
Q

what are the 4
integer primitive types
and their size in bytes

A

these include
* byte (1 byte)
* short (2 bytes)
* int (4 bytes)
* long (8 bytes)

21
Q

describe
widening casting
and the order of types

A

this is the act of converting a smaller type to a larger type size
byte -> short -> char -> int -> long -> float -> double

22
Q

describe
multiple instances

A

this is the act of having many instances from a single class. Each instance is an object that can change its state by adjusting the values of its fields

23
Q

what are the 2
other primitive types
and their size

A

these include
* char (2 bytes)
* boolean (1 bit)

24
Q

describe
narrowing casting
and the order of types

A

this is the act of converting a larger type to a smaller size type
double -> float -> long -> int -> char -> short -> byte

25
Q

when naming these they always begin with a capital letter

A

what is the convention for naming classes

26
Q

is a specific entity of a class that will have the characteristics of its class but will be specific to this object

A

describe an
object

27
Q

what are the two types of
casting
in java and how does it occur

A

this feature includes
* widening casting (occurs automatically)
* narrowing casting (occurs manualy)

28
Q

what are the two data types found in java

A

these include
* primitive types
* object types

29
Q

what is the convention for naming classes

A

when naming these they always begin with a capital letter

30
Q
  • these are predefined data types of Java. They specify the size and type of any standard values
  • these are not associated with classes and so have no methods
  • when this is declared in a variable it is stored directly, if the variable is copied then another copy is created
A

describe in 3 points javas
primitive data types

31
Q

this is when you assign a value of one primitive data type to another type.

A

what is type casting

32
Q

this is made up of
fields
and
methods

A

what is inside an
object

33
Q

what is inside an
object

A

this is made up of
fields
and
methods

34
Q

describe an
instance

A

an object is an instance of a class

35
Q

why is car a class and not an object

A

the car is a class because we cannot answer questions about a particular car
such as
* what colour is the car
* what horse power is the car

36
Q

this feature includes
* widening casting (occurs automatically)
* narrowing casting (occurs manualy)

A

what are the two types of
casting
in java and how does it occur

37
Q

what is the convention for naming
objects

A

when naming these they always begin with a lower case letter

38
Q

view link

39
Q

this is the act of converting a larger type to a smaller size type
double -> float -> long -> int -> char -> short -> byte

A

describe
narrowing casting
and the order of types

40
Q

these include
* primitive types
* object types

A

what are the two data types found in java