1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Reika [66]
3 years ago
14

Create a class called Jack that extends Leo. This class must have the following behaviors/methods. You must use the inheritance

to reuse the methods from the parent classes. Solution without using the inheritance will get zero points. re-writting the code that already exists will get zero credit. A call to the methods in the parent classes must be donemethod description
method1 display "Jack 1 Leo 1 "
method2 displays "Don 2 Jack 2"
method3 displays "Jack 3 Leo 3 Don 2 "
toString displays" Jack 3 Leo 1"
Computers and Technology
1 answer:
lara [203]3 years ago
8 0

Answer:

public class Leo{

public String method1(){

return "Jack 1 Leo 1";

}

public String method2(){

return "Don 2 Jack 2";

}

public String method3(){

return "Jack 3 Leo 3 Don 2";

}

public String toString(){

return "Jack 3 Leo 1"

}

}

public class Jack extends Leo{

}

Explanation:

Leo is the parent class and jack inherits all of its attributes from Leo

So when you call the following code in the main method:

Jack j = new Jack();

System.out.println(j.method1);

it should print Jack 1 Leo 1

This is because the program first checks if method 1 exists in the Jack class

Because it doesn't exist it then goes to the parent class which is Leo.

And in the Leo class method1 displays "Jack 1 Leo 1 "

So it prints that

You might be interested in
Anyone have some good animes to watch, i finished haikyuu, BNHA, Kakegurui, and a whisker away -.-
kow [346]

Answer:

yeah u should watch the Knight of Zodiac

Explanation:

8 0
3 years ago
Read 2 more answers
What is the answer ??​
Blizzard [7]

Answer:

D all of the above

B operating system

7 0
3 years ago
Read 2 more answers
A goal should be___.
Luda [366]

Answer:

D

Explanation:

5 0
3 years ago
Read 2 more answers
Am nevoie de un referat pe tema ,,Asezarea in Pagina '' la informatica
In-s [12.5K]

Answer:

Explanation:

Microsoft Word este un procesor de text modern,Microsoft Excel,

Microsoft PowerPoint si Microsoft Access.

Programul va poate ajuta sa realizati documente,

5 0
3 years ago
There’s No Difference In Security If You Use A Public PC Or Your Own Computer.
Andreas93 [3]
False because if you use public someone else could be using it as a a trap to get your information and with your own if you no how to use it well you will be safe


3 0
4 years ago
Other questions:
  • Objectivity is only a small part of assessing a Web site. <br> a. True<br> b. False
    10·1 answer
  • Where are the Add Level and Delete Level buttons located? Filter options list Sort &amp; Filter group Sort dialog box Custom fil
    11·1 answer
  • Given: int[][] values = new int[4][5] Using the statement above, write a nested loop to set values as follows: (3 pts) [0] [1] [
    13·1 answer
  • A friend is interested in keeping track of information about his album collection. He is not concerned about whether or not the
    11·1 answer
  • How do you make computers or microwaves?
    13·1 answer
  • PLEASE CLICK THIS VIRUS LINK
    7·1 answer
  • Why do we use antivirus program?<br><br>please tell fast​
    12·1 answer
  • Please help with my Python code - Functions
    9·1 answer
  • What triggers a LinkedIn account ban?
    6·1 answer
  • Write a program that simulates applying a "boost" to a spaceship in a spaceship race game.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!