Please... Explain the following code... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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 ?

21st Sep 2019, 12:26 PM
Sp Maurya
Sp Maurya - avatar
2 Answers
+ 3
"\\." dot as delimiter -1 "the pattern will be applied as many times as possible" "76.88." -> {"76", "88",""}
21st Sep 2019, 10:41 PM
zemiak
+ 1
ok now i am starting to understand...
22nd Sep 2019, 5:42 AM
Sp Maurya
Sp Maurya - avatar