+ 3

How to declare the characeter if of A- because char letter = 'A-' is error?

17th Dec 2019, 7:45 AM
Azhar Sajis
Azhar Sajis - avatar
6 odpowiedzi
+ 5
Just use System.out.print("A-"); This can be useful when do coding of selection
17th Dec 2019, 7:48 AM
Saiful Sajis
Saiful Sajis - avatar
+ 3
char is only valid for single characters.
19th Dec 2019, 6:55 AM
Sonic
Sonic - avatar
+ 2
You should use String instead of char
19th Dec 2019, 3:51 AM
Naman Pandey
Naman Pandey - avatar
+ 1
Use string if it is more than one letters, char is only supporting one letter value. String word = "A-";
17th Dec 2019, 8:06 AM
Ipang
+ 1
Alternatively Also you can use char array to store those two... char[] word={'A', '-'};
17th Dec 2019, 9:45 AM
Jayakrishna 🇮🇳
+ 1
हक
18th Dec 2019, 7:30 PM
राम