Question: When creating a method in a class, you could make the method static if: Question 1 Select one or more: a . It does not
When creating a method in a class, you could make the method static if:
Question Select one or more:
a
It does not use any instance attributes
b
It needs access to instance attributes
c
You don't want to create an instance to use the method
d
You use the this keyword inside the method.
Question
Not yet answered
Marked out of
Flag question
Question text
Assume we have a Java class Music and some subclasses of Music: Jazz, HipHop, and KPop, each of which define a public method play We then have some code that defines an array of Music objects, songs, and iterates over that array, for Music song : songs song.play When song is an object of type Jazz, this code calls the play method defined in the Jazz class, and when it is an object of type KPop, this same code calls the play method defined in the KPop class. This is an example of
Question Answer
a
polymorphism
b
abstraction
c
information hiding
d
encapsulation
Question
Not yet answered
Marked out of
Flag question
Question text
A access modifier means that the attributemethod is not accessible to anyone outside the class.
Question Answer
a
Protected
b
Package
c
Private
d
Public
Question
Not yet answered
Marked out of
Flag question
Question text
A try statement must be followed by catch or finally blocks.
Question Answer
a
zero or one
b
one or more
c
zero or more
d
exactly one
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
