0
Why I am getting error in java?
I am just beginners to java.And started getting errors in variables. https://code.sololearn.com/cT48VgQWF9CB/?ref=app
6 Answers
+ 4
Vinay Jaiswal
Because vi is a character and you have initialised as a string.
Single quotes represent character
Double quotes represent String
+ 2
try
char vi='D';
+ 1
Thanks
0
Igor Kostrikin,your variable is working.But why not my one.
0
Oooooo
0
Vinay Jaiswal thats because its 2 different types. Python and js ignore that. Nvm if u use " " or ' '. But C family and Java (as i know C is parent for Java?đ¤đ¤) are strict for this. So, " " not equals to ' '. Double quotes " " - are for strings, single quotes ' ' - are for chars