This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
System.out.print(new String("\u0041")); --> result is 'A'
but 1). System.out.println(new String(CharUtils.unicodeEscaped('A'))) --> resutl is \u0041 , why not 'A'? 2) CharUtils.unicodeEscaped('A').equals(new String("\u0041")) --> result is false , why not true ?
Doesn't the CharUtils class have another method for converting back? I don't have it here and I don't really feel like hunting down its documentation on the Internet.
If it doesn't, then you can convert the last four of those six characters to a char like this:But if you think you need to do this, and you aren't writing a Java compiler or parser, you probably don't really need to do this.