[Solved] Adding a “space” value to a char in Java


As per my understanding you are trying to assign space value in to char type .But the value you given is a string and trying to assign in to a char type .if u want to assign a space character do it by using ‘ ‘.

char mychar=" "; //wont works because you are assigning  a string type in to char type

but

char mychar=" ";//this will work because assigning a char type in to char type

solved Adding a “space” value to a char in Java