stud
bud
Sign up
Log in
Home
Library
Explore
SAT
More
Fontys Venlo - Programming Concepts - week 8 Flashcards | StudBud
Explore
/
Fontys Venlo - Programming Concepts - week 8
Fontys Venlo - Programming Concepts - week 8
10 terms
·
StudBud Administration
·
69 plays
#fontys #fhtenl #prc1 #java #week8
Flashcards
10 cards
F
Practice quiz
P
Host live
L
Questions
10
Answers
1
How do you correctly create an object of a
Ninja class
called
Kai
?
new Ninja = Kai("Ninja");
Kai ninja = new Kai()
Ninja kai = new Ninja("Kai")
Ninja n = Ninja.newInstance()
2
How to (re)use the second constructor
correctly
in the first constructor? (
read code carefully)
Sheep.Sheep(0, "sheep1");
new Sheep(defaultID, name);
this(defaultId, name);
Sheep.this(defaultId, "sheep1");
3
What is the
class contract
?
Signatures of all private methods and constants
Signatures of all private methods
Signatures of all public methods
Signatures of all public methods and constants
4
Regarding
primitive wrapper classes,
which statement is
NOT
true?
They can have convenient conversion methods
They are the same as primitive types
They can have constructors.
They can have constants.
5
What does
NOT
correctly describe a class?
A class is a concrete real world object
A class is similar to a template
A class is a general concept of a real world object
A class is similar to a blueprint
6
What is the output of the following code? (
see picture
-
ignore carriage return
)
false true
true false
false false
true true
7
Regarding
static fields
which statement is correct?
Static fields can only be added to objects
It is a part of the class, shared by all instances
Has for each instance of a class a different value
It is part of an object, connected to an instance
8
Which conditions describe an immutable class? (
see code
) A class has...
... only private data fields.
All answers are correct
no methods which can return a reference to a mutable field.
... has no mutator methods for data fields.
9
Regarding visibility of accessors of
variables
, what is
NOT
correct?
private: can be seen by objects of other classes
public can be seen by whole world
private: accessible only by object of the same class.
public: cannot be seen by objects of other classes
10
How is the method called which is named exactly like the Class, here
Ninja
? (
see picture
)
Instance Method
public method
Garbage Collector
Constructor