Given the following class definition, public class Pen { private String name; public Pen(String n) { name = n; } @Override public String toString() { return this.name + "-"; } } public class Brush extends Pen { private int ink; public Brush(String n, int m) { super(n); ink = m; } @Override public String toString() { return super.toString() + this.ink + "-"; } } What is the output of the following program? Brush fluffy = new Brush("Fluffy", 5); System.out.print(fluffy); If there is no output, please specify "nothing" (no quotes) in the blank for the output. No hand written and fast answer with explanation
Given the following class definition,
public class Pen
{
private String name;
public Pen(String n)
{
name = n;
}
@Override
public String toString()
{
return this.name + "-";
}
}
public class Brush extends Pen
{
private int ink;
public Brush(String n, int m)
{
super(n);
ink = m;
}
@Override
public String toString()
{
return super.toString() + this.ink + "-";
}
}
What is the output of the following program?
Brush fluffy = new Brush("Fluffy", 5);
System.out.print(fluffy);
If there is no output, please specify "nothing" (no quotes) in the blank for the output.
No hand written and fast answer with explanation
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 4 images