Groovy Quiz 27 | Abstract Classes


Reference video | Groovy Playground


1 Point for every correct answer | Let’s Get Started

1.

An abstract class is declared with a keyword abstract

e.g.

abstract class Car{
}
 
 

2.

An abstract class cannot have non-abstract methods

hint

abstract methods have only method signature and no body.

abstract methods are declared with keyword abstract

e.g.

public abstract void maxSpeed();

 

 
 

3.

An abstract class cannot be instantiated. (Objects cannot be created for an abstract class)

 
 

4.

An abstract class can have

final method

static method

constructors

 
 

5.

To use any method or field of an abstract class, it has to be extended in a child class because abstract classes cannot be instantiated.

 
 

6.

The body for abstract methods inside an abstract class has to be provided in its child class

 
 

7