What is true about the class Wow?

Given:
<code>
public abstract class Wow {
private int wow;
public wow (int wow) {
this.wow = wow;
}
public void wow () {}
private void wowza () {}
}
</code>
What is true about the class Wow?

Given:

public abstract class Wow {
private int wow;
public wow (int wow) {
this.wow = wow;
}
public void wow () {}
private void wowza () {}
}

What is true about the class Wow?

A.
It compiles without error.

B.
It does not compile because an abstract class cannot have private methods.

C.
It does not compile because an abstract class cannot have instance variables.

D.
It does not compile because an abstract class must have at least one abstract method.

E.
It does not compile because an abstract class must have a constructor with no arguments.

Explanation:

An abstract class is a class that is declared abstract—it may or may not include abstract methods
(not B, not D). Abstract classes cannot be instantiated, but they can be subclassed.
The code compiles with a failure for line ‘public wow (int wow) {‘



Leave a Reply 5

Your email address will not be published. Required fields are marked *


tw

tw

Answer: A ?

Marin R

Marin R

Yes, A is correct. This exam has too many questions answered incorrectly…

sully

sully

Correct answer is C i believe abstract class not allowed to have implementation

Oene Bakker

Oene Bakker

I agree with answer A
Tried it in Eclipse getting no errors