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:

Expert Answer

Want to see the step-by-step answer?

Check out a sample Q&A here.

Want to see this answer and more?

Experts are waiting 24/7 to provide step-by-step solutions in as fast as 30 minutes!*

*Response times may vary by subject and question complexity. Median response time is 34 minutes for paid subscribers and may be longer for promotional offers.
Tagged in
Engineering
Computer Science

Related Computer Science Q&A

Find answers to questions asked by students like you.

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...

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...

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...

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.

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...

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...

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 ...

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 ...

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 ...

Q: create a python program that will ask users to input four different manufacturers of cars(e.g Ford, ...

A: Create a class Car and define _init_ () function which will initialize the value of variables manufa...

Q: Rainfall StatisticsWrite a program that lets the user enter the total rainfall for each of 12 months...

A: The following program is in C++ language and it is compiled in the “repl.it” compiler.Program plan:I...

Q: Write a class, AgeMessages , which does the following:a. Ask the user to enter age using a Scannerb....

A: //Import required packagesimport java.util.Scanner; //Definition of class "AgeMessage"public class A...

Q: This is for pygame Text Class The Text class inherits from Drawable and it will be used to display t...

A: Instructions for the Text class:Import the Drawable class and pygame module.Create a class Text and ...

Q: A common problem in health informatics is to read a message from another healthcare organization and...

A: In order to solve the problem we would follow these steps:Break the entire string into tokens separa...

Q: Problem: Develop a class encapsulating the concept of a college course, assuming that a course has f...

A: The program has the following algorithm: Course.javaCreate default constructors.Test the “set” metho...

Q: Construct a dfa that accepts the language generated by the grammar S → abA, A → baB, B → aA|bb.

A: Deterministic finite automata (DFA):

Q: Find a regular grammar that generates the language on Σ = {a, b} consisting of all strings with no m...

A: Regular grammar for the language Σ = {a, b} is as follows:

Q: Transform the grammar with productions S → baAB, A → bAB|λ, B → BAa |A| λ into Chomsky normal form.

A: A context free grammar is in Chomsky normal form if its productions are in the formA → a or A → BC o...

Q: Hence the grammar:         G: ({S, A, B}, {a, b}, S, { S →bbAbabB,  A → aA|B| λ  , B → bB|A| λ}) Dra...

A: Derive the string bbaababaa with the given grammar using either leftmost or right most derivation.De...

Q: Develop pseudocode for the problem of reading in an arbitrary number of DNA (deoxyribonucleic acid) ...

A: PseudocodeCreate a dictionary data structure to store the DNA base and the complementary base as ser...

Q: 4-20) (Process a string) Write a program that prompts the user to enter a string and displays its le...

A: Program to enter string by the user to displays string length and its first character. as in the giv...

Q: As an IT manager, what strategy would you have followed to avoid the failed implementation of ERP sy...

A: ERP system:It denotes software for business process management that permits an organization in using...

Q: 1) The UsingMethod class consists of a main method and a method called xMethod. What will the code p...

A: Hey, since there are multiple questions posted, we will answer first question. If you want any speci...

Q: What are the errors in the following code?

A: Given below are the errors found in the code send by you along with an error free code.

Q: CHALLENGE 1.24: Read multiple user inputs. ACTIVITY Write two scnr.nextint statements to get input v...

A: Given below is the program to get input values for month and year and write the output value as a mo...

Q: Assignment: Check the Sample run first, then carefully read the instructions and write aprogram that...

A: Solution:Given data,The java code gets the first name, last name, and secret number to generate the ...

Q: Which filenames would be a subsequent ls command display?$ lsabc abd abe abf abg abh$ rm abc ab*rm: ...

A: To describe which filenames the subsequent ls command display.

Q: Create a trigger called Trig_Enroll_BI on the ENROLLMENT table that fires before an INSERT statement...

A: Solution:Create the trigger with name of “Trig_Enroll_BI” for ENROLLMENT table.The followings algori...

Q: Show that the language L = {w : na (w) = nb (w)} is not regular. Is L∗ regular?

A: Solution:Given that,L = {w: na(w) = nb(w)}Justification:Use the pumping lemma theorem to verify a la...

Q: Create a new file in c++ and save it as lab11_XYZ.cpp (replace XYZ with your initials). Create ANOTH...

A: Program Instructions:In the header file, create a temporary variable temp of the data type of each v...

Q: Write a python code of a function that takes in four points in a counterclockwise order, a, b, c, d ...

A: Program Instructions:Create a function isConvex() and pass the four points as arguments.Save the par...

Q: Construct the XOR operator using only NAND gates. Hint:x XOR y = ((x′y)′(xy′)′)′

A: Drive XOR  operator using only NAND gates:-Let’s assume that the two inputs of NAND and XOR gates  a...

Q: I have a HW that is asking me to draw on ERD diagram for a simple purchasing system that has order w...

A: ERD diagram for Purchasing System:The ERD diagram for the simple purchasing system is as follows:

Q: I am trying to convert a string in hexadecimal to an integer, or it's decimal value. For example A6 ...

A: As there is no particular programming language mentioned, we are doing this conversion of string in ...

Q: When working with database entity relationship modeling, should the cardinality between entities be ...

A: Cardinality: The maximum or minimum number of elements allowed on each side of the relationship in t...

Q: Show that the following grammar is ambiguous: S→AB|aaaB,A→a|Aa,B→b.

A: A grammar is known as ambiguous when there is more than one derivation tree (right most derivation t...

Q: you can allocate up to how many primary partitions on a hard drive

A: A hard drive usually comprises of primary partitions and logical partitions. Primary partition conta...

Q: Function Name: comboLock Parameters: num1 – a positive integer representing the first digit in the c...

A: Solution: The following function checks whether the five integers is in the order (odd, even, odd, e...

Q: In PL/SQL, Create a recursive store function called add_numbers to calculate the total of all consec...

A: Program plan:Declare the required variables.The “add_numbers” function returns the value. Otherwise,...

Q: rewrite the function F = (A ⊕ B) ⊕ C without the XOR operator, ⊕.

A: Boolean simplifications used to solve the given problem:

Q: Read in 5 letters from the keyboard, reverse the order of the second and next to last letters, and p...

A: Program to read 5 letters from the keyboards and reversing the order of the second and next to last ...

Q: Design a modular program that asks the user to enter the monthly costs for the following expenses in...

A: We are designing the program in C++ programming language. Given below is the program designed to ent...

Q: Write two scnr.nextInt statements to get the input values into birthMonth and birthYear.Then write a...

A: Given below is the program to get input values for month and year and write the output value as a mo...

Q: Write a program called StudentTable that prints the below table. Use only print() orprintf(). DO NOT...

A: Using the given hint "printf" the below program was done in C language where "println()" is used in ...

Q: Used Java 4.23 (Financial application: payroll) Write a program that reads the following information...

A: The program would have the following 4 sections:The declaration and initialization of the variables ...

Q: Problem: Create a base class called Vehicle that has the manufacturer’s name (typeString), number of...

A: Program plan:Create a class called “Person” with required constructors and methods.Create a class ca...

Q: Which command can you use to determine who is logged in on a specific terminal?

A: Different commands are used to determine who is logged in on a specific terminal. These commands are...

Q: Use eclipse for these methods

A: Solution:Given data,The java code to display the output for method calls using the method overloadin...

Q: Question: Write a function to display a pattern as follows: 1 2       1 ... ... n       n-1         ...

A: Solution:The python program has the following algorithm:In the displayPattern() function,Declare and...

Q: write a program in c++. You work for a box company, and have been asked to write a program to compar...

A: Solution:The C++ program has the following algorithm:Declare and initialize the required variables.D...