This is the code to convert string into unicode but I get an error as "illegal start of an expresssion"while running the code..
import java.util.Scanner; import java.lang.String; import java.lang.Character; public class A { public static void main(String args[]) { public static String GetUnicode(String str_code) // here i get the error { String hexCode = Integer.toHexString(str_code.codePointAt(0)).toUpperCase(); String hexCodeWithAllLeadingZeros = "0000" + hexCode; String hexCodeWithLeadingZeros = hexCodeWithAllLeadingZeros.substring(hexCodeWithAllLeadingZeros.length() - 4); hexCodeWithLeadingZeros = "\\u" + hexCodeWithLeadingZeros; System.out.println("Unicode " + hexCodeWithLeadingZeros); return hexCodeWithLeadingZeros; }} }