menu
bartleby
search
close search
Hit Return to see all results

What is the output of the following code:public class A{public int methodOfA(int i){i += 10;return i*= 2;}}public class B extends A{public int methodOfB(int i){i *= 40;return methodOfA(i);}}public class MainClass{public static void main(String[] args){B b = new B();System.out.println(b.methodOfB(100));}}Output: ______________________Show work here:

Question

What is the output of the following code:

public class A
{
public int methodOfA(int i)
{
i += 10;

return i*= 2;
}
}

public class B extends A
{
public int methodOfB(int i)
{
i *= 40;

return methodOfA(i);
}
}

public class MainClass
{
public static void main(String[] args)
{
B b = new B();

System.out.println(b.methodOfB(100));
}
}


Output: ______________________


Show work here:

check_circleAnswer
Step 1

Given program:

File name: A.java

fullscreen
Step 2

File name: B.java

fullscreen
Step 3

File name: MainC...

fullscreen

Want to see the full answer?

See Solution

Check out a sample Q&A here.

Want to see this answer and more?

Our solutions are written by experts, many with advanced degrees, and available 24/7

See Solution
Tagged in

Engineering

Computer Science

Related Computer Science Q&A

Find answers to questions asked by student like you

Show more Q&A add
question_answer

Q: 5-18) (Display four patterns using loops) Ask the user to enter an integer toset a limit for nested ...

A: The algorithm would run into 4 sections for each pattern. For patterns A and C each line will have i...

question_answer

Q: How to use ProstgreSQL in my local Java IDE using SSH tunnelingon a Mac using intellj Idea , eclipse...

A: Lets first check about Intellij:1) Open the Database tool window (View | Tool Windows | Database) an...

question_answer

Q: example:"apple->orange->banana->pear"->NULLreturn "orange"Thanks!

A: ApproachIn the function longest(), we'll declare an integer named highestLength and assign 0 to it.N...

question_answer

Q: I am trying to read in a text file called "lines.txt" that holds an entire dictionary of words with ...

A: First you need to use the ifstream class object to read from file.

question_answer

Q: This program uses hours, pay rate, state tax and fed tax to determine grossand net pay. The code is ...

A: Program Descriptions:The given program does not have any errors.It takes input from a file named pay...

question_answer

Q: What’s the difference between integer, Floating point, and integer variable length? And how do I cal...

A: Assuming you are working in C language the explanation for the two data types integer and floating p...

question_answer

Q: I have a Python question and I cannot seem to figure out how to answer this problem exactly (I've at...

A: Hey..To print the power of 2 you have to use a  power function  "pow(2,N) " .It is inbuild function ...

question_answer

Q: Find an nfa that accepts the complement from L (ab∗aa + bba∗ab)?

A: Solution:The following graph indicates the NFA (Non-deterministic finite automata) is given below:M ...

question_answer

Q: how to write a function in python 3 that reads a txt file which includes three number (each line has...

A: AlgorithimStartOpen a file in read modeRead a line from file and store the number in variable aRead ...

Sorry about that. What wasn’t helpful?