That is not how toString works. You have to call the method on an object and you do not pass it a parameter.


class Foo {
String name;
String dob;

Foo(String n, String d) {
...