DEFINING CLASS WITH DATA MEMBERS AND MEMBER FUNCTIONS - Carrier Study

Breaking

Home Top Ad

Responsive Ads Here

Friday, May 25, 2018

DEFINING CLASS WITH DATA MEMBERS AND MEMBER FUNCTIONS

class test
{
int a,b;
void get()
{
a=25;
b=40;
}
void show()
{
system.out.println("a value :" +a);
system.out.println("b value :"+b);
}
}
class extest
{
public static void main(string args[])
{
test t1;
t1=new test();
test t2=new test();
t1=get();
t2=get();
system.out.println("t1 object");
t1.show();
system.out.println("t2 object");
t2.show();
}
}

No comments:

Post a Comment