Can anyone tell me what is the meaning of '/'? And when to use ' ' and " ". | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Can anyone tell me what is the meaning of '/'? And when to use ' ' and " ".

1st Dec 2016, 11:05 PM
Vicky Li
Vicky Li - avatar
5 Answers
+ 8
Everything inside the ' ' is considered a char in java. So you can write . char a = '/'; char b = '#'; The difference between char and String is that char is only and always one character (letter or symbol). But String can be zero or more characters. Also char is a primitive type. String is a class. You can think of char like a letter and String like a word (a collection of letters or an array of chars if you like more).
1st Dec 2016, 11:53 PM
R2-D2
R2-D2 - avatar
+ 2
Thx Nedim! Is it # and / consider as char also? I see the book write like : showLine('#'); and showLine('/', 20);
1st Dec 2016, 11:24 PM
Vicky Li
Vicky Li - avatar
+ 2
It simply means u assigning the forward slash(/)and (#) to a variable of type char
2nd Dec 2016, 9:51 AM
Decodeworms Olamilekan
Decodeworms Olamilekan - avatar
+ 1
single quotes are for chars, double quotes are for Strings, example: char c = 'a'; String s = "hello";
1st Dec 2016, 11:08 PM
Nedim Kanat
Nedim Kanat - avatar
+ 1
Q = char Question = string the simple ex for meaning of char and string
25th Dec 2016, 3:02 PM
Kishan Sharma
Kishan Sharma - avatar