Unclosed Character Literal error

In Java, single quotes can only take one character, with escape if necessary. You need to use full quotation marks as follows for strings:

y = "hello";

You also used


which I assume should be


Note: When making char values (you’ll likely use them later) you need single quotes. For example:

char foo='m';

Leave a Comment