So my java code involves defining an object constructor class:
public static class bookID{
bookID(String startAuthor, String startGenre, int startNumID){
String author = startAuthor;
String genre = startGenre;
int numID = startNumID;
String finalID = author + genre + Integer.toString(numID);
}
}
And then instantiating the class after processing the user's input (in the main method of the program).
bookID newID = new bookID(authFinal, genre, numID);
books.add(newID);
System.out.println(newID.finalID);
However, the last line is throwing an error, saying it 'cannot find symbol' of the finalID variable, despite newID already being called and it should have an instance of finalID as a field. Can anyone point out what I'm doing wrong here?
Here's the error:
Bookstore.java:100 error: cannot find symbol
System.out.println(newID.finalID);
symbol: variable finalID
location: variable newID of type bookID