Why does the second line of this code throw ArrayIndexOutOfBoundsException?

String filename = "D:/some folder/001.docx";
String extensionRemoved = filename.split(".")[0];

While this works:

String driveLetter = filename.split("https://stackoverflow.com/")[0];

I use Java 7.

4 Answers
4

Leave a Reply

Your email address will not be published. Required fields are marked *