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]
2 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]2 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
Ayuda por favor.<br><br>Please help!!
rewona [7]

Answer:

I know you're going to delete my answer... But I have an essay which needs to be completed online and I need to ask a urgent question!

If you have a better reason WHY you need me to answer the RIGHT answer... Please reply.

Explanation:

8 0
2 years ago
Que significa el término “Informática”?
Ad libitum [116K]

Answer:

Explanation:

proviene del francés informatique, implementado por el ingeniero Philippe Dreyfus a comienzos de la década del '60. ... De esta forma, la informática se refiere al procesamiento automático de información mediante dispositivos electrónicos y sistemas computacionales.

4 0
3 years ago
What is output by the following?<br><br>print (type("95"))
statuscvo [17]

Answer:

The output is "<class 'str'> ".

Explanation:

In the given python code a print() function is defined. Inside this function, a type() function will use, in which a numeric value is passed in the double quotes (" ") as a function parameter. Double quotes are normally used for print value as a message but in this code, value is not printed because we use the type() function.

  • The type() function Returns the parameter class type of the argument(object).
  • This function is used for debugging. In this function, we pass a single parameter that will return the type of given object.
6 0
3 years ago
Which of the following would be a valid method call for the following method? public static void showProduct (int num1, double n
Alenkinab [10]

Answer:

showProduct(int,double)

for example: showProduct(10,10.5) is the correct answer even showProduct(10,10.0) is also correct but showProduct(10.0,10.5) or showProduct(10,10) or showProduct(10.0,10) are wrong calls.

Explanation:

The code is

  1.       <em>public static void showProduct (int num1, double num2){</em>
  2. <em>       int product;</em>
  3. <em>       product = num1*(int)num2;</em>
  4. <em>       System.out.println("The product is "+product);</em>
  5. <em>       }</em>

showProduct is function which asks for two arguments whenever it is called, first one is integer and second one is of type double which is nothing but decimal point numbers. Generally, in programming languages, 10 is treated as integer but 10.0 is treated as decimal point number, but in real life they are same.

If showProduct( 10,10.0) is called the output will be 'The product is 100'.

Strange fact is that, if you enter showProduct(10,10.5) the output will remain same as 'The product is 100'. This happens because in the 3rd line of code,which is <em>product=num1*(int)num2</em>, (int) is placed before num2 which makes num2 as of type integer, which means whatever the value of num2 two is given, numbers after decimal is erased and only the integer part is used there.

This is necessary in JAVA and many other programming languages as you <u>cannot</u><u> multiply two different datatypes</u> (here one is int and another is double). Either both of them should be of type int or both should be of type double.

3 0
2 years ago
Most networking media send data using _____ in which data is represented by only two discrete states: 0s and 1s.
dlinn [17]

Answer:

i think digital signals

Explanation:

A digital signal is a signal that is being used to represent data as a sequence of discrete values; at any given time it can only take on one of a finite number of values.[1][2][3] This contrasts with an analog signal, which represents continuous values; at any given time it represents a real number within a continuous range of values.

6 0
3 years ago
Read 2 more answers
Other questions:
  • You want to deploy software using group policy. what is necessary before deciding to assign the software to your user accounts?
    11·1 answer
  • What udp port is used for i k e traffic from vpn client to server?
    14·1 answer
  • Using features on demand results in saving potentially significant amounts of disk space. features on demand becomes a third ins
    14·1 answer
  • To copy text in a Word document to an Excel spreadsheet, you should first format the text as a Word table or as text separated b
    11·2 answers
  • In which type of attack do you get malicious code in links from seemingly reliable websites?
    14·1 answer
  • Computer virus is a<br> a. software<br> b. hardware<br> c. bacteria<br> d. none of these
    13·1 answer
  • Higher-speed Ethernet technologies use an electronic device known as a Hub rather than a switch True/False
    15·1 answer
  • The purpose of the ___________ is to provide sufficient notice to individuals whose personal information has been stolen so they
    13·1 answer
  • Do you have to make a account of Windows 10?
    12·1 answer
  • What methods would you add to make this class declarationvery useful?
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!