Note that there are some explanatory texts on larger screens.

plurals
  1. POreturn an ArrayList method
    primarykey
    data
    text
    <p>This is a drive method for two other classes. which i posted here <a href="https://codereview.stackexchange.com/questions/33148/book-program-with-arraylist">https://codereview.stackexchange.com/questions/33148/book-program-with-arraylist</a> </p> <p>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.</p> <p>Instruction</p> <p>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. </p> <pre><code>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&lt;String&gt; authors = new ArrayList&lt;String&gt;(); ArrayList&lt;Book&gt; books = new ArrayList&lt;Book&gt;(); for (int i = 0; i &lt; titles.length; i++) { authors = getAuthors(allAuthors[i]); Book b = new Book(titles[i], authors); books.add(b); authors.remove(0); } Library lib = new Library(books); System.out.println(lib); lib.sort(); System.out.println(lib); } private static ArrayList&lt;String&gt; getAuthors(String authors) { ArrayList books = new ArrayList&lt;String&gt;(); // need help here. return books; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload