Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

suppose that you have thefollowing class definitions: public class SuperClass {

ID: 3611822 • Letter: S

Question

suppose that you have thefollowing class definitions:
public class SuperClass
{
protected int x;
private Stringstr;

public void print()
{
System.out.println(x+""+str);
}

public SuperClass()
{
str="";
x=0;
}

public SuperClass(String s,int a)
{
str=s;
x=a;
}
}

public class SubClass extends SuperClass
{
private int y;

public void print()
{
System.out.println("SubClass:"+y);
super.print();
}
public SubClass()
{
super();=0;
}
public SubClass(String s,int a,int b)
{
super("Hellosuper",a+b);
y=b;
}
}

what is the output of the following java code?

SuperClass superObject=new SuperClass("This issuperClass",2);
SubClass subObject=new SubClass("DDDDDDD",3,7);

superObject.print();
subObject.print();







suppose that you have thefollowing class definitions:
public class SuperClass
{
protected int x;
private Stringstr;

public void print()
{
System.out.println(x+""+str);
}

public SuperClass()
{
str="";
x=0;
}

public SuperClass(String s,int a)
{
str=s;
x=a;
}
}

public class SubClass extends SuperClass
{
private int y;

public void print()
{
System.out.println("SubClass:"+y);
super.print();
}
public SubClass()
{
super();=0;
}
public SubClass(String s,int a,int b)
{
super("Hellosuper",a+b);
y=b;
}
}

what is the output of the following java code?

SuperClass superObject=new SuperClass("This issuperClass",2);
SubClass subObject=new SubClass("DDDDDDD",3,7);

superObject.print();
subObject.print();







Explanation / Answer

Output of given questions is:
2 This is superClass
SubClass:7
10 Hello super ITS HELPFUL TO YOU....