class A
{
int a,b,c;
public A() //default constructor
{
a=4;
b=5;
c=a*b;
System.out.print("into= "+c);
}
public A(int x, int y) //parameterised constructor
{
c=x+y;
System.out.print("\nSUM= "+c);
}
}
public class consdes {
public static void main(String[] args) {
A t=new A();
A o=new A(1,2);
}
}
{
int a,b,c;
public A() //default constructor
{
a=4;
b=5;
c=a*b;
System.out.print("into= "+c);
}
public A(int x, int y) //parameterised constructor
{
c=x+y;
System.out.print("\nSUM= "+c);
}
}
public class consdes {
public static void main(String[] args) {
A t=new A();
A o=new A(1,2);
}
}
output:
into= 20
SUM= 3
No comments:
Post a Comment
SAY HELLO!!