Java Programing
Pages
Home
Projects
Tricks
Contact Us
About Us
Saturday, November 7, 2015
Program of Parameterized Constructor
class Add
{
int a,b,c;
public Add(int x,int y)
{
a=x;
b=y;
c=a+b;
}
void display()
{
System.out.println("Sum is = "+c);
}
}
class ParaConst
{
public static void main(String args[])
{
Add obj = new Add(10,12);
obj.display();
}
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment