I have created an interface for my business class. I have my business logic which displays the name. I want to display the name by using an interface. I heard that in order to hide the business logic we use interface but how do I do it? This is what I have tried but I don't know how to use it.
public interface Business_Logic_Interface {
public String getName();
}
public class Business_Logic implements Business_Logic_Interface {
private String name = "I am business data";
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
public class MainApp implements Business_Logic_Interface {
public static void main(String[] args) {}
@Override
public String getName() {
// TODO Auto-generated method stub
return null;
}
}
I want to display the name by using interface.