String class provides split() method to split String in Java, based upon any delimiter, e.g. comma, colon, space or any arbitrary method. split() method splits string based on delimiter provided, and return a String array, which contains individual Strings.
Actually, split() method takes a regular expression, which in simplest case can be a single word. split() is also overloaded method in java.lang.String class and its overloaded version takes a limit parameter which is used to control how many times pattern will be applied during splitting process.
If this limit is positive n, then pattern will be applied at most n-1 times, if it's negative or zero than split operation is applied any number of time. For example, if we split String "First,Second,Third" on comma and provide limit as 2 then pattern will run one time, and split() will return String array with 2 Strings, "First" and "Second,Third". Since this method accepts a Java regular expression, it throws.