I am trying to create two separate strings from one string around a delimiter using split. However it keeps telling me I am going out of bounds. The book I am reading uses this example:
reads: 3/4 or something
String currentFraction = fractionReader.nextLine();
String numHolder = currentFraction.split("/")[0];
String denHolder = currentFraction.split("/")[1];
When I try my own such as :
reading: 5.93
String moneyHolder = moneyReader.nextLine();
String dolHolder = moneyHolder.split(".")[0];
String centHolder = moneyHolder.split(".")[1];
I am guessing I have to make an array and then split it? All the examples I see online are for each loops printing stuff out. So how would I catch the left and right of the split into two strings?