Whats the output to this? public static void main(String[] args) { twinInt s = new twinInt(3, 6); twinInt s2 = new twinInt(2, 5); System.out.println(s); } //… class baseStatic { private int number; public baseStatic(int number) { this.number += number; } public int Calc() { return number; } } class twinInt extends baseStatic { private static int store; public twinInt(int i, int j) { super(i + j); store = j; } public String toString() { return ""+store+Calc(); } }
Whats the output to this?
public static void main(String[] args)
{
twinInt s = new twinInt(3, 6);
twinInt s2 = new twinInt(2, 5);
System.out.println(s);
}
//…
class baseStatic
{
private int number;
public baseStatic(int number)
{
this.number += number;
}
public int Calc()
{
return number;
}
}
class twinInt extends baseStatic
{
private static int store;
public twinInt(int i, int j)
{
super(i + j);
store = j;
}
public String toString()
{
return ""+store+Calc();
}
}
Step by step
Solved in 2 steps with 2 images