a question on an ap prep book

E

Eileen

public class Tulip
{
private int numTulips;

public Tulip(int nt)
{
numTulips = nt;
}

public String toString()
{
return "numTulips: " + numTulips;
}
}

what is demonstrated by the Tulip class declaration?
a. implementing an abstract method
b. implementing an abstract interface
c. composition
d. overriding an inherited method
e. multiple inheritance
 
S

Stefan Ram

Eileen said:
first, java doesnt have multiple inheritance so (e) cant be true, and
i dont think it inherites anything so to me (d) is false as well.

Java also does not have »abstract interfaces«.
 
P

Patricia Shanahan

Eileen said:
public class Tulip
{ ....
first, java doesnt have multiple inheritance so (e) cant be true, and
i dont think it inherites anything so to me (d) is false as well.

Remember that "public class Tulip {" is equivalent to "public class
Tulip extends Object {".

Patricia
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top