class Person {
private String name;
private int age;
Person() {
this.name = "";
this.age = 0;
}
Person(String name, int age) {
this.name = name;
this.age = age;
}
void getName(String name) {
}
}
I am new to Java and was practicing making objects. In the code above I created a Person object with two overloaded constructors. I hope those are correct. I tried making a method without specifying that returns void and got an error. Do methods inside of objects always require a return type? I'm not sure why the IDE gave me an error when I didn't specify it as void.
*edit I realized I never actually created the Person object, only the Person class.