Your LinkedList does not have common types, so you cannot declare it as
LinkedList<Object> listOne = new LinkedList<Object>();
but rather how
LinkedList listOne = new LinkedList();
And now to add items just use your add method
listOne.add("something"); listOne.add(1);
Also, if you want to add data from the keyboard, you can use something like
String line=""; do{ System.out.println("type what you want to add to list:"); line = keyboard.nextLine(); listOne.add(line); }while(!line.equals("exit"));
source share