return an ArrayList method

This is a drive method for two other classes. which i posted here

I need some help for the private static ArrayList getAuthors(String authors) method. I am kind a beginner. so please help me finish this drive method. or give me some directions.


some of the elements of the allAuthors array contain asterisks “*” between two authors names. The getAuthors method uses this asterisk as a delimiter between names to store them separately in the returned ArrayList of Strings.

import java.util.ArrayList;

public class LibraryDrive {

public static void main(String[] args) {

    String[] titles = { "The Hobbit", "Acer Dumpling", "A Christmas Carol",
            "Marley and Me", "Building Java Programs",
    "Java, How to Program" };

    String[] allAuthors = { "Tolkien, J.R.", "Doofus, Robert",
            "Dickens, Charles", "Remember, SomeoneIdont",
            "Reges, Stuart*Stepp, Marty", "Deitel, Paul*Deitel, Harvery" };

    ArrayList<String> authors = new ArrayList<String>();
    ArrayList<Book> books = new ArrayList<Book>();

    for (int i = 0; i < titles.length; i++) {
        authors = getAuthors(allAuthors[i]);
        Book b = new Book(titles[i], authors);
    Library lib = new Library(books);


private static ArrayList<String> getAuthors(String authors) {
    ArrayList books = new ArrayList<String>();
            // need help here.
    return books;


Leave a Comment