Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Given the program with method that receives object. 8. 1. class Add 2. { 3. int a; 4. int b; 5. 6 Add (int x,
Given the program with method that receives object. 8. 1. class Add 2. { 3. int a; 4. int b; 5. 6 Add (int x, int y) // parameterized constuctor 7. { a=x; 9. b=x; 10. } 11. void sum (Add anobject) 12. { 13. int suml=anobject.a+anobject.b; 14. System.out.println("Sum of a and b: "+suml); 15. } 16. } 17. 18. 19. 20. 21. 22. 23. 24. 25. class classExAdd { public static void main(String arg[]) { Add obj =new Add (5,8); obj.sum (obj); a) Refer to Line 8 and Line 9. What are the values of a and b? [6 marks] b) What is the value of sum1 at Line 13? [2.5 marks)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started