Java: Invalid Character Constant error occurring

本小妞迷上赌 提交于 2020-05-18 08:32:22

问题


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?


回答1:


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

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

or

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



回答2:


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



来源:https://stackoverflow.com/questions/41432855/java-invalid-character-constant-error-occurring

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!