Forum : using inheritance gettin null values
Brief description  about Online courses   join in Online courses
View Priti m naik 's Profile

using inheritance gettin null values

class Person{
public static void main(String[] args)
{
Info i=new Info();
SoftwareEngineer p=new SoftwareEngineer();

i.Age(33);
i.Qual("B.E in cse MBA");

p.printinfo();

}
}


class SoftwareEngineer extends Info
{

}


class Info{

int age;
String qual;

void Age(int value)
{
age=value;
}


void Qual(String string)
{
qual=string;
}


void printinfo()
{

System.out.println("the qual of the client is " qual);
System.out.println("the age of the client is" age);

}
}


my output is null vales whats wrong


Asked by Priti m naik | Aug 27, 2010 |  Reply now
Replies (2)
View priti m naik 's Profile
hi thx it works
Aug 28, 2010
View vijay kumar thota 's Profile
class Info
{
int age;
String qual;

void Age(int value)
{
this.age=value;
}
void Qual(String string)
{
this.qual=string;
}

void printinfo()
{
System.out.println("the age of the client is "+age);
System.out.println("the qual of the client is "+qual);
}
}

class SoftwareEngineer extends Info
{

}

class Q
{
public static void main(String[] args)
{
//Info i=new Info();
SoftwareEngineer p=new SoftwareEngineer();

p.Age(33);
p.Qual("B.E in cse MBA");
p.printinfo();
}
}


hi..priti, now plz. check it out
Aug 27, 2010