Eddie997
17.04.2020 •
Computers and Technology
Look at the following code. The method in line will override the method in line . Line 1 public class ClassA Line 2 { Line 3 public ClassA() {} Line 4 public int method1(int a){} Line 5 public double method2(int b){} Line 6 } Line 7 public ClassB extends ClassA Line 8 { Line 9 public ClassB(){} Line 10 public int method1(int b, int c){} Line 11 public double method2(double c){} Line 12 }
Solved
Show answers
More tips
- L Leisure and Entertainment 10 Ways to Celebrate Your Favorite Holidays: A Guide to Festivities and Traditions...
- S Sport When will the Biathlon World Championships 2011 take place in Khanty-Mansiysk? Answers to frequently asked questions...
- O Other What is a Disk Emulsifier and How Does it Work?...
- F Family and Home What does a newborn need?...
- F Family and Home Choosing the Right Car Seat for Your Child: Tips and Recommendations...
- F Food and Cooking How to Get Reconfirmation of Registration?...
- C Computers and Internet How to Get Rid of Spam in ICQ?...
- A Art and Culture Who Said The Less We Love a Woman, the More She Likes Us ?...
- F Family and Home How to Get Rid of Your Neighbors?...
- S Society and Politics How Could Nobody Know About the Dead Mountaineers?...
Answers on questions: Computers and Technology
- P Physics 2 What is a newton-meter used to measure? displacement gravitational field strength force moment...
- B Business Mojo Mining has a bond outstanding that sells for $1,061 and matures in 25 years. The bond pays semiannual coupons and has a coupon rate of 6.1 percent. The par value...
- B Biology Which type of molecule makes up the double layer of a cell membrane?...
- C Chemistry Determine the molar solubility of baf2 in pure water. ksp for baf2 = 2.45 x 10-5. 1.83 x 10-2 m 1.23 x 10-5 m 2.90 x 10-2 m 4.95 x 10-3 m 6.13 x 10-6 m...
- M Mathematics Polly had 5 times as many red balloons as many red balloons as blue ones. She had 18 all together. How many of her balloons were blue ones?...
Ответ:
The method in line 11 will override the method in line 5.
Explanation:
As ClassB implements ClassA's functions, any functions with the same signature (name + arguments) will be overridden due to inheritance in Java.
There is a false herring as you could answer line 10 overrides the method as defined in line 4 - however this is not overridden as they do not share the exact same parameters (different parameter names are fine, however different parameter types are not), (int b, int c) as opposed to (int a).
Hope this helps, feel free to message me for any more information!
Edit 1:
I've just realised that method2 in ClassA takes an integer parameter, whereas method2 in ClassB takes a double as a parameter. This may be a typo as they return the same type from the function - however if it is not the case that this is a typo then I don't see any way how ClassB could override methods from ClassA.
Ответ:
d. subscript
Explanation:
Although I believe "index" is a better term. The question already says it!