Look at the following code snippet in Java.
final public class Main
{
public static void main(String[] args)
{
Locale.setDefault(new Locale("lt"));
String str = "\u00cc"; //setting Lithuanian as locale
System.out.println("Before case conversion is "+str+" and length is "+str.length());// Ì
String lowerCaseStr = str.toLowerCase();
System.out.println("Lower case is "+lowerCaseStr+" and length is "+lowerCaseStr.length());// i?`
}
}
It displays the following output.
Before case conversion is Ì and length is 1
Lower case is i̇̀ and length is 3
In the first System.out.println()
statement, the result is exact. In the second statement, however, it displays the length 3 which actually should have been 1. I don't understand, Why?