Search Header Logo

Java Inheritance and Method Quiz

Authored by COY DUANE WEBB

Professional Development

12th Grade

Used 14+ times

Java Inheritance and Method Quiz
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

7 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is inheritance in Java?

Creating a new class using an existing class

Overloading methods

Changing the behavior of a superclass

Creating multiple instances of a class

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do we declare a PainterPlus class in the Painter superclass?

public void painterplus extends painter

public void PainterPlus extends Painter {

public class PainterPlus extends Painter() {

public class PainterPlus extends Painter {

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

True or False: A superclass can use methods from a subclass.

True

False

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do we instantiate an object in the PainterPlus class?

PainterPlus = new PainterPlus();

PainterPlus painter = new PainterPlus();

new PainterPlus Painter();

Painter painter = PainterPlus();

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the correct while loop to make the painter continuously move until it can't?

while (canMove()) { move();

}

while (canMove); { move();

}

while (isMoving()) { move();

}

while (canMove()) { stop();

}

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the correct syntax to write a method paintToEmpty that makes the painter paint until it runs out of paint?

public void paintToEmpty() { while (hasPaint()) { paint(); } }

public void paintToEmpty() { while (canPaint()) { paint(); } }

public void paintToEmpty() { while (isPainting()) { paint(); } }

public void paintToEmpty() { while (hasPaint()) { stop(); } }

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which keyword is used to inherit a class in Java?

implements

extends

inherits

super

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?