0

Please... Explain the following code...

public class Main { public static void main(String[] args) { String a[] = "76.88.".split("\\.",-1); System.out.println(a.length); } } // The Output is 3 but How ?

9/21/2019 12:26:04 PM

Sp Maurya

3 Answers

New Answer

+3

Starting from back there is an empty string between dot and closing double quote. So that empty string plus "88" and "76" makes 3 strings Print the array and print some value after it to confirm.

+2

"\\." dot as delimiter -1 "the pattern will be applied as many times as possible" "76.88." -> {"76", "88",""}

+1

ok now i am starting to understand...