class Myclass //
{
String name;
int rollno;
Myclass()
{
System.out.println("no paramerterized constructor");
}
Myclass(int b)
{
this();
System.out.println("one paramerterized constructor");
}
Myclass(String a,int b)
{
this(10);
System.out.println("two paramerterized constructor");
this.print();
}
void print()
{
System.out.println("constructor is called print method");
}
public static void main(String args[])
{
Myclass m1=new Myclass("Ramu",511);
}
};
No comments:
Post a Comment