Balázs Szmetana
Balázs Szmetana

Reputation: 57

Java: Invalid Character Constant error occurring

I'm try to make a notification. I saw a little tutorial but something is not working for me.

JLabel messageLabel = new JLabel('<HtMl>'+message);

"Invalid Character Constant"

Why is this error occurring?

Upvotes: 0

Views: 1090

Answers (2)

Mnemonics
Mnemonics

Reputation: 699

You should use double quotes instead of single quotes to resolve your problem.

Upvotes: 0

ddarellis
ddarellis

Reputation: 3960

You need double quotes the single quotes is for char literals.

JLabel messageLabel = new JLabel("<HtMl>"+message);

or

JLabel messageLabel = new JLabel('l'+message);

Upvotes: 1

Related Questions