I have two classes: Person and PersonDemo.
Person holds all the methods, etc, etc, whilst PersonDemo is as named, just for a demo.
However, PersonDemo throws up a lot of errors in my Eclipse console, but won't
^No errors in that class.public class Person { String forename; String surname; int age; public String getName(Person nameToGet) { return forename + surname; } public Person(Person ID, String createdForename, String createdSurname, int createdAge) { this.forename = createdForename; this.surname = createdSurname; this.age = createdAge; } public void printPersonsInfo(Person infoToGet) { System.out.println("Name = "+getName(infoToGet)+"; Age = " + infoToGet.age); } }
^I get errors on lines 2 and 5.public class PersonDemo { Person(johnSmith001, "John", "Smith", 43);//Error here, on "Person(" public static void main(String args[]) { printPersonsInfo(johnSmith001);//Error here, on "johnSmith001" } }
Upon running the demo, "Name = John Smith; Age = 43" should be printed into the console.