import java.util.;
import java.lang.;
import java.io.*;
class Book {
private String author;
private String title;
public Book(String author, String title) {
this.author = author;
this.title = title;
}
public String toString() {
return "Title: "" + title + "", author: " + author;
}
public String getTitle() {
return title;
}
public String getAuthor() {
return author;
}
public boolean equals(Object o){
Book e = (Book) o;
return (author.equals(e.getAuthor())) &&
(title.equals(e.getTitle()));
}
}
class LinkedListBooksLibrary {
private LinkedList<Book> theList;
private Book book;
public LinkedListBooksLibrary(LinkedList<Book> newList) {
this.theList = newList;
this.book = book;
}
public void addBooksToLinkedList() {
for(int n = 0; n < 100000; n++) {
theList.add(new Book("Author nr " + n, "Title nr " + n));
}
System.out.println("Quantity of elements in the LinkedList the collection: " + theList.size());
System.out.println();
}
public void linkedListProcessor() {
theList.addLast(new Book("Author nr " + n, "Title nr " + n));
}
}
class LinkedListExample
{
public static void main (String[] args) throws java.lang.Exception
{
LinkedList<Book> theList = new LinkedList<Book>();
LinkedListBooksLibrary process = new LinkedListBooksLibrary(theList);
process.addBooksToLinkedList();
process.linkedListProcessor();
}
}
chciałbym dodać ostatni element do listy
nie chce sie kompilować
błąd : cannot find symbol symbol: variable n location: class LinkedListBooksLibrary, line 41
cannot find symbol symbol: variable n location: class LinkedListBooksLibrary, line 41
prosszę o pomoc - brak już pomysłów - dziekuję