Predict the output constructors
user_4300037950
java
4 years ago
453 B
178
Indexable
public class Sample
{
public Sample()
{
System.out.println("Default constructor");
}
public Sample(int i)
{
this();
System.out.println("Single parameter constructor: " + i);
}
public Sample(int i, int j)
{
this(j);
System.out.println("Double parameter constructor: " + i + ", " + j);
}
public static void main(String a[])
{
Sample ch = new Sample(0, 2);
}
}Editor is loading...