Why Charactor ch="o"; is not valid in Java? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Why Charactor ch="o"; is not valid in Java?

10th Jul 2017, 7:00 AM
Umer Khan
Umer Khan - avatar
2 Answers
+ 5
char ch='o';
10th Jul 2017, 7:15 AM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
+ 2
You should use a single quote to represent a character in Java. otherwise, if you use double quote, even for a single character, it will rather be treated as a string. example: char ch='o';//character char ch="o";//error String ch="o";//string :)
10th Jul 2017, 8:01 AM
Millo
Millo - avatar