class SuperClass { private int x; private int y; public SuperClass () { x = 2; y = 3; } public Superclass (int x, int y) { this.x = x; this.y = y; } public String tostring () { return "Numbers are:...


please base from the first picture and answer the second image.


class SuperClass {<br>private int x;<br>private int y;<br>public SuperClass ()<br>{ x = 2; y = 3; }<br>public Superclass (int x, int y)<br>{ this.x = x; this.y = y; }<br>public String tostring ()<br>{ return

Extracted text: class SuperClass { private int x; private int y; public SuperClass () { x = 2; y = 3; } public Superclass (int x, int y) { this.x = x; this.y = y; } public String tostring () { return "Numbers are: "+x + " and"+ y; } public int returnSum() { return (x+y); } class SubClass extends SuperClass { private int z; public SubClass() { super(); } public SubClass(int x, int y) { super(x, y); z = 4; } public int returnSum() { return (super.returnSum() + z); } } and the declarations: SuperClass obj1 = new Superclass(); SuperClass obj2 = new SubClass(1, 2);
Given the following statement, what will display to the screen?<br>System.out.print(

Extracted text: Given the following statement, what will display to the screen? System.out.print("Sum is:" + obj2.returnSum()); Sum is: 20 Sum is: 200 Sum is: 4 Invalid statement – won't compile None of the above.

Jun 01, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here