stud
bud
Sign up
Log in
Home
Library
Explore
SAT
More
Fontys Venlo - Programming Concepts - week 10 Flashcards | StudBud
Explore
/
Fontys Venlo - Programming Concepts - week 10
Fontys Venlo - Programming Concepts - week 10
10 terms
·
StudBud Administration
·
70 plays
#fontys #fhtenl #prc1 #java #week10
Flashcards
10 cards
F
Practice quiz
P
Host live
L
Questions
10
Answers
1
Regarding
overloading and overriding
which statement is
correct
?
Overriding: extend a subclass from a superclass
Overloading: new implementation for method in subclass
Overloading: Methods with same name but different signatures
Overriding: Methods with same name but different signatures
2
What is the output of the following code? (
see picture
-
ignore carriage return
)
true true
false true
true false
false false
3
Regarding
primitive wrapper classes,
which statement is
NOT
true?
They are the same as primitive types
They can have convenient conversion methods
They can have constructors.
They can have constants.
4
How to correctly define an
ArrayList
of Lions?
Lion<ArrayList> lions = new Lion<ArrayList>();
ArrayList<Lion> lions = new ArrayList<Lion>();
ArrayList<> lions = new ArrayList<>();
Lion<> lions = new Lion<ArrayList>();
5
How to (re)use the second constructor
correctly
in the first constructor? (
read code carefully)
new Sheep(defaultID, name);
Sheep.this(defaultId, "sheep1");
Sheep.Sheep(0, "sheep1");
this(defaultId, name);
6
What is
NOT
a characteristic of
inheritance
?
IS an HAS-A relationship
Avoids redundancy
Is an IS-A relationship
Allows defining new classes from existing classes.
7
Which conditions describe an immutable class? (
see code
) A class has...
... only private data fields.
no methods which can return a reference to a mutable field.
All answers are correct
... has no mutator methods for data fields.
8
What is the
class contract
?
Signatures of all private methods
Signatures of all public methods
Signatures of all private methods and constants
Signatures of all public methods and constants
9
Which description is correct? (
see picture
)
1
3
2
4
10
Regarding data and method visibility which statement about class/method
modifier
is
incorrect
?
private: Accessable from the same class
default: Accessable from the same package
public: Accessable from a different package
protected: Accessable from subclass from different package.