Character literals represents alphabets (both cases), numbers (0 to 9), special characters (@, ?, & etc.) and escape sequences like \n, \b etc.
Whereas, the String literal represents objects of String class.
public class LiteralsExample { public static void main(String args[]){ char ch = 'H'; String str = "Hello"; System.out.println("Value of character: "+ch); System.out.println("Value of string: "+str); } }
Value of character: H Value of string: Hello