Consider the following class definitions.
public class A
{
private int al;
public void methodA()
{
methodB(); // Statement I
}
}
public class B extends A
{
public void methodB()
{
methodaA(); // Statement II
al = 0; // Statement III
}
}
Which of the labeled statements in the methods shown above will cause a compile-time error?
I only
I only
A
III only
III only
B
I and II
I and II
C
I and III
I and III
D
II and III
II and III
E

Answers

Answer 1

The statement which will cause a compile-time error in the given class definitions is "II only". Hence, option A is correct.Explanation:The given classes are used to test the hierarchical inheritance concept in Java programming language.

The class B is a subclass of class A and it inherits the methods of class A including methodA().The methodA() in class A calls the methodB() of the same class A. Whereas, the methodB() of class B calls the methodA() of class A.The methodB() of class B also contains two other statements labeled as statement II and statement III. In statement II, it tries to call the methodA() again, which may cause infinite recursion.

Whereas, in statement III, it initializes the value of a private integer field "al" to 0.However, the given statement II in the methodB() of class B, "methodaA()" is not spelled correctly, it should be "methodA()". Hence, the statement II will cause a compile-time error. Thus, option A is correct.

To know more about hierarchical visit:

https://brainly.com/question/29620982

#SPJ11


Related Questions

Other Questions
the new receptionist seems like she is well qualified. the new receptionist seems as if she is well qualified. A car travels at 100 km/h behind a truck with a speed of 75 km/hat a distance of 1 km from it. How long will it take the car tocatch up with the truck?A car accelerates from 15 m/s to 25 m/s in 5 s The manufacture of paint requires the production of the base, mixing of suitable colors, and packing. Until the 1980s, all these processes were performed in large factories, and paint cans were shipped to stores. Given the uncertainty of demand, though, the paint supply chain had great difficulty matching supply and demand. In the 1990s, paint supply chains were restructured so mixing of colors was done at retail stores after customers placed their orders. The result is that customers are always able to get the color of their choice, whereas total paint inventories across the supply chain have declined. The paint industry provides an excellent example of (Select all correct answers) the value of postponement. the gains from suitably adjusting the push/pull boundary. the cycle view of supply chain processes. the benefits of risk pooling, Determine the charge on each ion in the following compounds, and name the compound. Spelling counts! (a.) Li20 (b.) CaS "Explore the different datasets and graph brain mass vs. body mass on a log-log scale. Which group(s) of animals have (or had) brains that scale larger with increasing body size?BirdsFishMammalsReptilesDinosaurs PROBLEM 1: Prepare and evaluate financial statements from accounts (22% Marks) A list of accounts for Geewhiz Productions Co. Ltd at November 30, 2019, is shown below, in no particular order or preference. $78,000 Dividends declared Salaries Expense Income tax payable Land $ 14,000 108,000 3,200 Accumulated amortisation 74,000 Cash in Bank 27,000 13,200 Income tax expense 8,100 6,100 Credit Sales Revenue 402,200 Employees Benefits expenses Tax deductions payable Accounts Receivable Cash Sales Revenue 18,600 Inventory on Hand 78,000 33,400 Prepaid Insurance Asset 3,200 Beginning Retained 7,500 Earnings 96,600 Dividends Payable Amortisation expense 53,000 37,200 Accounts payable 184,100 Interest Income Cost of goods sold expense 2,100 13,800 Building 346,000 Insurance expense Share Capital 300,000 Trucks and Equipment 253,400 Office Expense 5,200 46,200 Salaries payable 169,800 Mortgage Payable 9,700 Miscellaneous Expenses Interest expense Bank loan owing 37,900 20,500 Required: i. Using the list, decide which ones are income statement accounts. Estimate net income based on your answer to part 1. (3 marks) (2 marks) (2 marks) iii. Estimate ending retained earnings based on your answer to part 2. iv. Prepare the following financial statements, demonstrating that your answers to parts 2 and 3 are correct: a. Income statement for the year ended November 30, 2019. (312 marks) (2 marks) b. Statement of retained earnings for the year ended on that date. c. Balance sheet at November 30, 2019. V. Comment briefly on what the financial statements show about the company's year 2019 and financial position at November 30, 2019. (5% marks) performance for the (4 marks) In order to analyze how people explain others' behavior, Fritz Heider developed: a.) cognitive dissonance theory b.) scapegoat theory c.) attribution theory Ed's construction company has the following short-run cost function: 19 - 8q2 + 38q. What is the minimum average cost? Perform the indicated goodness-of-fit test. Use a significance level of 0.01 to test the claim that workplace accidents are distributed on workdays as follows: Monday 25%, Tuesday: 15%, Wednesday: 15%, Thursday: 15%, and Friday: 30%. In a study of 100 workplace accidents, 22 occurred on a Monday, 16 occurred on a Tuesday, 15 occurred on a Wednesday, 16 occurred on a Thursday, and 31 occurred on a Friday. a. The Degrees of Freedom are Type in a whole number. k b. The Test Statistic is Round to 3 decimal places. c. There sufficient evidence to conclude that workplace accidents are distributed on workdays as follows: Monday 25%, Tuesday: 15%, Wednesday: 15%, Thursday: 15%, and Friday: 30%. Type in "is" or "is not exactly as you see here. signs of a severe airway obstruction in an infant or child include: pol Consider the market for tangelo oranges and suppose the demand function is given by Q=2000-2P, where represents the quantity demanded of tangelo oranges and p represents the price per pound. Suppose the supply function is given by Q=3P. where Q represents the quantity supplied. Find the equilibrium quantity and price of tangelo oranges in the market. d O a. Equilibrium price and quantity are, respectively, P=400, Q = 1200- O b. Equilibrium price and quantity are, respectively, P=500, Q=500. O c. Equilibrium price and quantity are, respectively, P= 1000, Q=300. O d. Equilibrium price and quantity are, respectively, P=425, Q=925 QUESTION 3 Suppose the population's income increases, shifting the demand curve to the right. Now the demand curve for tangelo oranges becomes Q-4000-2P. The supply curve remains the same. Q=3P. The new equilibrium price and quantity in the market are: O a. P=800, Q=2400. O b. p=2200, Q=1100. OCP=500, Q=500. O d. P=100, Q=250. 10 poi According to the Quantity theory of Money, MV=PT, if the Central Bank increases the supply of money dramatically, the main consequence will be: (some versions of the model use Y instead of T) P will increase None of the above V will increase T will increase What is the bond's yield to maturity (YTM)? A) 9.26%. B) 10.34%. C) 10.05%. D) 10.55%. QUESTION 10 Benet Division of United Refinery Company's operating results include: controllable margin, 200,000; sales 2,200,000; and operating assets, 800,000. The Benet Division's ROI is 25%. Management is considering a project with sales of 100,000, variable expenses of 60,000, fixed costs of 40,000; and an asset investment of 150,000. Should management accept this new project? No, since ROI will be lowered. Yes, since ROI will increase. O Yes, since additional sales always mean more customers. No, since a loss will be incurred. QUESTION 11 The Fulmar Division of Jayne Manufacturing had an ROI of 25% when sales were 3 million and controllable margin was 600,000. What were the average operating assets? 150,000 750,000 2,400,000 O 12,000 Directions Read the instructions for this self-checked activity. Type in your response to each question, and check your answers. At the end of the activity, write a brief evaluation of your work. Activity In this activity, you will apply the laws of sines and cosines to solve for the missing angles and side lengths in non-right triangles. Question 1 in triangle ABC, ZA = 35,mZB = 60, and the length of side AB is 6 cm. Find the length of side BC using the law of sines. Adam Inc. is a manufacturing firm which designs and manufactures electric switches for use in construction. Below is the expected (budgeted) data for the start of next year: September October November 600 800 740 $20.00 $22.00 $21.00 Sales in units Sales price per unit August 400 $18.00 The desired ending inventory for finished goods (production) is 20% of next month's sales. The desired ending inventory for raw materials is 40% of the next month's raw material requirements. Raw material required for each unit of the product is 5 units. The cost of each unit of raw material is $3 per unit. Time required to assemble one (1) switch is 15 minutes. Workers are paid $20 per direct labour hour. Using the above information answer the following questions. Using the sales budget, calculate the budgeted sales for September. HINT: remember the entry rules! Complete the production budget. How many units will have to be produced in September to meet the requirements? HINT: What are the "Units to be produced" on the production budget for September? Prepare the Direct Materials Purchases Budget. What will be the cost of September's production? HINT: On the Direct Materials Purchases Budget, what will be the "Total direct materials cost"? Prepare the Direct Labour Budget. What will be the total direct labour cost (rounded to the nearest dollar) for September? Briefly explain what "no barriers to entry" mean for a competitive marketQ2. Out of the 3 conditions below, which one is for finding the profit maximizing quantity, which one is for a firm to be profitable, and which one for a firm to keep operating (not shut down)?P > ATCP > AVCMR = MC QUESTION 39 Which of the following is consistent with lowering the lovel of risks associated with supply networks? Increasing digitization Increasing complexity of category strategies Increasing outsourcing Increasing supply chain regionalization I QUESTION 40 Which of these statements is not projected to be a future focus of supply chains? Obtaining more innovation from suppliers Leveraging supplier capabilities O An increased focus on tactical purchasing activities Increased cost management efforts QUESTION 41 When did supply chains start to transition from a vertical orientation to a horizontal orientation? 1970's 1980's O 1990's 2000's No story. Just the mathematical model of consumer choice. Consider a consumer whose preferences are represented by the following utility function (defined over bundles of exes and whys): u(x, y) = 2x+y. (a) Are the consumer's preferences convex? 1 point (b) Find the consumer's marginal rate of substitution, and show that its absolute value decreases as the consumption of exes increases. 1 point Py, respec- (c) Find the consumer's demand function of exes. In other words, find her optimal con- sumption level of exes when the unit prices of exes and whys are px and tively, and her income is m. 1 point (d) Find the mathematical expression that describes the consumer's Engel curve for exes, and represent it graphically. 1 point (e) Find the mathematical expression that describes the consumer's income-offer curve, and represent it graphically. 1 point (f) Find the mathematical expression that describes the consumer's demand curve for exes, and represent it graphically. 1 point (g) Suppose that the government levies a per-unit tax (t) on exes, so that their new unit price is p = Px + t. Show that the change in the consumer's demand for exes is entirely due to the substitution effect. You are allowed to ignore corner solutions in this part of the exercise. The following figure shows the results of the ultimatum game played by farmers in Kenya and university students in the US. Students, Emory University (US) (darker shading shows the proportion of offers expected to be rejected) Farmers (Kenya) (darker shading shows the proportion of offers expected to be rejected) Kenyan farmer Responders are expected to reject a 40% offer 4% of the time 45 Half of the Kenyan farmer proposers made an offer of 40% Kenyan farmer Responders are expected to reject a 30% offer 48% of the time 0 10 20 30 40 50 Fraction of the pie offered by the Proposer to the Responder (%) Which of the following statements is incorrect about the ultimatum game? The figure above shows that different groups of people may be subject to social preferences in different ways. O b. The ultimatum game is used to study social preferences. Oc. If all participants are solely self-interested, the responders of the game are predicted to accept 20% or higher percentage of the pie. d. The lab experiment results of the ultimatum game such as the figure above show that participants are not solely self-interested. Share of the Proposers making the offer indicated (%) 30 55