javascript
Brief description  about Online courses   join in Online courses
View nagaraju  chunchula 's Profile

why this below error

interface Bank_Account
{
public void customerName();

public void accountType();

public void customerAdd();
}

interface Bank_Account1 extends Bank_Account
{
public void customerAge();

public void customerProf();
}

class Customer implements Bank_Account
{
String name;
String type;
String add;
int age;
String prof;

Customer(String name,String type,String add)
{
this.name=name;
this.type=type;
this.add=add;
}


public void customerName()
{
System.out.println("Name:" name);
}

public void accountType()
{
System.out.println("Account type:" type);
}

public void customerAdd()
{
System.out.println("Address:" add);
}
}

class Customer1 implements Bank_Account1
{
int age;
String prof;

Customer1(int age,String prof)
{
this.age=age;
this.prof=prof;
}

public void customerAge()
{
System.out.println("Age=" age);
}

public void customerProf()
{
System.out.println("Profession=" prof);
}
}

class MulInterface
{
public static void main(String arg[])
{
Customer cust=new Customer("Nagaraju","Savings","Bangalore");
cust.customerName();
cust.accountType();
cust.customerAdd();

Customer1 cust1=new Customer1(24,"Teacher");
cust1.customerAge();
cust1.customerProf();
}
}



/*E:\SilicanindiaJava\Inheritanc
Asked by nagaraju chunchula | Dec 29, 2010 |  Reply now
Replies (1)
View arun kumar das 's Profile
HI

if you are extending Bank_Account interface than you have to override all the method of Bank_Account interface in Customer1.



interface Bank_Account
{
public void customerName();

public void accountType();

public void customerAdd();
}

interface Bank_Account1
{
public void customerAge();

public void customerProf();
}

class Customer implements Bank_Account
{
String name;
String type;
String add;
int age;
String prof;

Customer(String name,String type,String add)
{
this.name=name;
this.type=type;
this.add=add;
}


public void customerName()
{
System.out.println("Name:"+name);
}

public void accountType()
{
System.out.println("Account type:"+type);
}

public void customerAdd()
{
System.out.println("Address:"+add);
}
}

class Customer1 implements Bank_Account1
{
int age;
String prof;

Customer1(int age,String prof)
{
this.age=age;
this.prof=prof;
}

public void customerAge()
{
System.out.println("Age="+age);
}
public void customerProf()
{
System.out.println("Profession="+prof);
}
}

class MulInterface
{
public static void main(String arg[])
{
Customer cust=new Customer("Nagaraju","Savings","Bangalore");
cust.customerName();
cust.accountType();
cust.customerAdd();

Customer1 cust1=new Customer1(24,"Teacher");
cust1.customerAge();
cust1.customerProf();
}
}

java teacher
Dec 29, 2010