package com.company;
import java.util.ArrayList;
import java.util.List;
public class Main {
public static void main(String[] args) {
ArrayList<Person> plot = new ArrayList<Person>();
plot.add(new Person("John"));
plot.add(new Person("Jane"));
RepkaStory.tell(plot);
}
private static class Person implements RepkaStory {
String name;
private Person(String name) { this.name= name; }
}
public interface RepkaStory {
static void tell(List<Person> a){
for (Person x : a ) {
System.out.println(x.toString);
}
}
}
}
but it gives as result
com.company.Main$Person@677327b6
com.company.Main$Person@1540e19d
and I can't convert it into String.