A) What are all the instance methods( , give method signature->access modifier,
ID: 3735660 • Letter: A
Question
A) What are all the instance methods( , give method signature->access modifier, return type, name, parameters of each, ) in the Animal class ?
B) What are all the instance methods ( , give method signature-access modifier, return type, name, parameters of each, ) that describes the Pet class ? Include inherited methods as well.
C) What are all the instance methods ( , give method signature-access modifier, return type, name, parameters of each, ) that describes the Cat class ? Include inherited methods as well.
public classl Animal private int legs: private boolean hasBrain true: private String eat: public void eat) system.out.printin("Eats food !"); ) public void sleep System.out.print ("Animal sleeps!"):Explanation / Answer
a)
Instance methods of Animal class:
public void eat();
public void sleep();
b)
Instance methods of Pet class:
public void sleep();
public void eat(String food);
public void eat(); // inherited from Animal class
c)
Instance methods of Cat class:
public void meow();
public sleep(String cat);
public void sleep(); // inherited from Pet class
public void eat(String food); // inherited from Pe
public void eat(); // inherited from Anim
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.