0
Can anyone show me an example of what char's do please in java solo learn briefly covers it.
5 Respuestas
+ 3
char is for characters, single characters.
char myChar = 'p';
Note the simple quotes, simple quotes are for chars while double quotes are for strings, otherwise it throws an error.
About what they do, whatever you can think of, for example: a console program that asks to continue (y/n).
You could use a string, but you only need one char, so you'd waste memory
+ 1
You could try to output one after another to make a word, or concatenate them, or I don't know, I don't really use chars
0
i see thanks, i have seen people use them to make words like hello world how is that done?
0
no probs thanks for your help
0
In addition to noname's answer: You might want to check a String char by char, for instance to check whether each is (or is not) a digit (number), a certain character, ...