Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Inheritance & Polymorphism

Total questions: 4

Worksheet time: 2mins

Name
Class
Date
1.
Polymorphism is when
a)
objects of different classes can respond to the same message
b)
different shapes exist
c)
one class inherits from another class
d)
a variable is protected
2.
Casting an object of class A into a variable of class B
a)
always works when A is a subclass of B
b)
always works when B is a subclass of A
c)
A is in the same package as B
d)
B is public
3.
If C is a class, and a and b are variables of that class, a==b means that
a)
the value of a is the same as the value of b
b)
a and be are referring to the same object
c)
a will get the value of b
d)
a will change to point to the same object as b
4.
Which of these modifiers means that the subclass cannot see it?
a)
public
b)
protected
c)
package
d)
private