Full Stack Developer (Java) Question:
Download Questions PDF

Tell us why isn’t String‘s .length() accurate?

Full Stack Developer (Java) Interview Question
Full Stack Developer (Java) Interview Question

Answer:

It isn’t accurate because it will only account for the number of characters within the String. In other words, it will fail to account for code points outside of what is called the BMP (Basic Multilingual Plane), that is, code points with a value of U+10000 or greater.

The reason is historical: when Java was first defined, one of its goal was to treat all text as Unicode; but at this time, Unicode did not define code points outside of the BMP. By the time Unicode defined such code points, it was too late for char to be changed.

Download Full Stack Developer (Java) Interview Questions And Answers PDF

Previous QuestionNext Question
Explain me what are the success factors for Continuous Integration?Please explain what is Event Loop?