I'm working on a homework problem that's due this evening. The prob asks to create a toString method that returns a "nicely formatted, multi-line description" of the class objects I created. The class is called "Book" and its objects are title, author, publisher, and copyright date. My toString code trying to use \n for a new line is as follows:
return ("Book - Title: "+ title\n"Author: "+ author\n"Publisher: " + publisher\n"Copyright: " + copyright);
This gives me several errors: syntax errors on the token n, syntax error insert ")" to complete expression, n cannot be resolved to a variable, syntax error on token "Invalid Character", ( expected...where am I going wrong? The only example I found in my text book uses the \n sequence in a System.out.println method. Can this even be used in a toString method?
I'm veeeeery new to java/code writing so any help would be much appreciated.