
consider the following interface
interface ATI
{
int getData();
void setData(int x);
}
write a class that implements the above interface.

interface ATI{
int getData();
void setData(int x);
}
class InterfaceExample implements ATI
{
int x;
public int getData(){
return x;
}
public void setData(int x){
this.x=x;
}
public static void main(String[] args)
{
InterfaceExample ex=new InterfaceExample();
ex.setData(5);
int num=ex.getData();
System.out.println(num);
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.