(40 40 Consider the following class definitions. public class A public String message (int i) return "A" i + public clas

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

(40 40 Consider the following class definitions. public class A public String message (int i) return "A" i + public clas

Post by answerhappygod »

40 40 Consider The Following Class Definitions Public Class A Public String Message Int I Return A I Public Clas 1
40 40 Consider The Following Class Definitions Public Class A Public String Message Int I Return A I Public Clas 1 (38.64 KiB) Viewed 72 times
(40 40 Consider the following class definitions. public class A public String message (int i) return "A" i + public class B extends A public String message (int i) return "B" 27 The following code segment appears in a class other than A or B. A objl= new B(); // Line 1 B obj2= new B(); // Line 2 // Line 3. System.out.println (objl.message (3)); System.out.println (obj2.message (2)); // Line 4 Which of the following best explains the difference, if any, in the behavior of the code segment that will result from removing the message method from class A ? (A) The statement in line 3 will cause a compiler error because the message method for obj1 cannot be found. (B) The statement in lin will cause a compiler error because the message be found. method for obj2 cannot will be executed instead of As a result of the method call in line 3. the message method in class B the message method in class A will be executed instead of (D) As a result of the method call in line 4, the message method in class B the message method in class A. (E) The behavior of the code segment will remain unchanged.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply