Hi everyone, I'm making a program to store library books details, my constructor is such:
public Book(String author, String title, String publisher, int year)
and I'm using an array to store and number the books and details, as such:
for(int i = 0; i <= 100; i++)
{
String book[i] = author + "-" + title + "-" + publisher + "-" + year;
}
The problem is, later on I need to print out the seperate details, each on different lines ie:
Judith Bishop
Java Gently
Addison-Wesley, 2001
Library number 345
so I wish to split the string at each "-" and put them on a new line. The question is how do I go about splitting the strings? I know there is a split method but I'm not sure how to use it.