no default constructor in a superclass
class One{
String s;
One(String s){
this.s = s;
}
}
class Two extends One{
Two(String s){
// problem
this.s = s;
}
}
interface implementation (method signature)class Persons{
String name;
Persons(String name){
this.name = name;
}
public String toString() {
return this.name;
}
}
interface Personable {
Persons getPerson(String name);
}
class MyPerson implements Personable{
Persons getPerson(String name) { // problem (must be public)
return new Persons(name);
}
public static void main(String[] args){
List ps = new ArrayList();
MyPerson m = new MyPerson();
for (int i = 100; i++ < 102; ps.add(m.getPerson("" + i)));
for(Object o:ps) System.out.println(o);
}
}