I have a concrete class A that implements interface B.
B ref = new A();
The code:
public interface B{ public abstract String[] getWords(); } public class A implements B { private String[] words = new String[] {}; public void setWords(String[] words){ this.words = words; } public String[] getWords(){ return this.words; } }
In interface B, I only have a getter method, but no setter method, although class A has it.
So, when I do this: B ref = new A(); Will this code work and how do I set the words?
source share