define a class data with data member acct_no,balance containing constructor data to initialize data member and a member function display for output.
Answers
Answered by
7
Explanation:
define a class data with data member acct_no,balance containing constructor data to initialize data member and a member function display for output.
Answered by
5
Program: [JAVA]
class Brainly
{
int a;
Number(int p)
{
a=p;
}
Number()
{
a=0;
}
void display()
{
System.out.println(a);
}
Number sum(Number ob)
{
Number s=new Number();
s.a=a+ob.a;
return s;
}
public static void main(String args[])
{
Number ob1=new Number(5);
Number ob2=new Number(6);
Number ob3=new Number();
ob3=ob1.sum(ob2);
ob3.display();
}
}
Similar questions