Difference between “char” and “String” in Java

char is one character. String is zero or more characters.

char is a primitive type. String is a class.

char c="a";
String s = "Hi!";

Note the single quotes for char, and double quotes for String.

Leave a Comment