toString only works every second iteration of the loop.
Josh Brand wrote:This is also after having added scan.nextLine(); after the num=scan.nextInt(); on line 13 as correctly highlighted by Carey Brown.
Carey Brown wrote:You have "setName()", it should be called "getName()".
You currently have no need for setters.
Liutauras Vilda wrote:You could try maybe to follow similar template for a start.
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your databasehttps://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database