OOP terms Flashcards

1
Q

what are the attributes of the object

A

its state eg colour, age,, size

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

what is the behaviour of the object

A

its functionality eg walk, sing

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

what is a class

A

a blueprint for a custom type

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

what does UML stand for

A

unified modeling language

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

what does + mean inUML

A

Public

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

what does - mean in UML

A

Private

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

create an object of class student

A

Student studentName = new Student();

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

what does encapsulate mean

A

not allow it to be exposed to the world

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

when are getters and setters used

A

when variables are private

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

why do we use getters and setters rather than leaving variables public

A

so that they cant be changed to crap eg length being a minus number

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

what is stack memory used for

A

variables and function calls

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

what is heap memory used for

A

to store objects

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

formal name for getters and setters

A

instance methods

accessors and mutators

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

creating an array of objects

A

type(class name) arrayName = new type[x]

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

what is method overloading

A

when there are more than one method with the same name but the compiler can tell them apart by their parameters/ list of parameters

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

why might static variables be used

A

universal to everyone

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

how are static variables accessed

A

ClassName.VariableName

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

can static variables be accessed outside of the class without creating an pbject of that class

A

yes

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

where are static variables stored

20
Q

what is a java interface

A

the minimum methods that must be implemented for the object to be useful

21
Q

example of making a class that uses an interface

A

public class Rectangle implements Shape

22
Q

what is a constructor

A

a method which initialises an object

23
Q

when are constructors invoked

A

object creation

24
Q

if you don’t make a constructor what happens

A

java makes a deafult one for you, all attributes set to 0 or null

25
does constructor have a return type
no
26
what should constructor be called
same name as class
27
what is a constructor which takes in parameters called
parametrized constructor
28
what is constructor overloading
multiple constructors, each with different parameter lists needed to handle different cases
29
what does key word this refer to
current object
30
what is constructor chaining
reusing constructors from other classes
31
when using constructor chaining, in what psoition should the call to the constructor be in the method
first statement
32
what is inheritence
a new class is created using an existing classes methods, possibly adding more capabilities
33
benefits of inheritence
more efficient cheaper loss copying
34
in inheritance what is the parent class called
superclass
35
in inheritence what is the child class called
subclass
36
what is a direct subclass
inherits explicitly from superclass above
37
what is an indirect subclass
inherits from classes above the class above
38
in java, all classes have the superclass of what
Object
39
can you inherit from multiple classes into one class
no
40
are constructors inherited
no, must be called using super
41
methods inherited from the superclass must be....
overrided
42
how can superclass methods be accessed in a subclasss
using super.methodName( )
43
what is polymorphism
when many objects can be passed into the same method and at runtime, the program is able to establish which versions to use (late binding)
44
what is upcasting
the typecasting of a child object to a parent object
45
what is an abstract class
a superclass from which other classes inherit and so they all have a common design but none of its methods are functioning, so it cannot be used to instantiate objects similar to an interface
46
what are concrete classes
classes which can be used to instantiate objects
47
a class which contains abstract methods must be a
n abstract class