0

😁😁😁 Please can you tell me why this answer is the correct ?

String[] a = ("76.88").split("."); System.out.print(a.length); The answer is : 0 Remarque : This is a JavaScript language ? Why !?

17th May 2021, 4:33 PM
Nacereddine Drici
Nacereddine Drici - avatar
5 Answers
+ 5
"Car" and "Carpet" are completely different thing. Don't get confuse with "Java" and "Javascript". Alpha Diallo is right.
17th May 2021, 4:40 PM
minirkk
minirkk - avatar
+ 2
This code is actually java and not javascript
17th May 2021, 4:35 PM
Alpha Diallo
Alpha Diallo - avatar
+ 1
it must be a problem related to the code playground. under certain circumstances even the Scanner class goes crazy on a pc it returns correctly 2
17th May 2021, 7:34 PM
Ciro Pellegrino
Ciro Pellegrino - avatar
+ 1
It is a problem related to sololearn code playground: by replacing the dot by a plus "+" inside the string passed as argument to the 'split' method, that result to an error talking about regex, even if we don't use regex ^^ I highly suspect a bug in sololearn pre-parsing system that cause thoses error/unexpected results (sololearn at least parse quickly your code to determine if you need inputs when running it) if you replace both dots by a minus "-", the expected result is correctly displayed in code playground (2)...
17th May 2021, 8:34 PM
visph
visph - avatar