Answered step by step
Verified Expert Solution
Link Copied!

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,

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke

4th Edition

0136086535, 9780136086536

More Books

Students also viewed these Databases questions

Question

What are the Five Phases of SDLC? Explain each briefly.

Answered: 1 week ago

Question

How can Change Control Procedures manage Project Creep?

Answered: 1 week ago