Is there a difference between single and double quotes in Java?

Use single quotes for literal chars, double quotes for literal Strings, like so:

char c="a";
String s = "hello";

They cannot be used any other way around (like in Python, for example).

Leave a Comment