+ 4
Can anyone tell me what is the meaning of '/'? And when to use ' ' and " ".
5 Respostas
+ 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).
+ 2
Thx Nedim! Is it # and / consider as char also? I see the book write like : showLine('#'); and showLine('/', 20);
+ 2
It simply means u assigning the forward slash(/)and (#) to
a variable of type char
+ 1
single quotes are for chars, double quotes are for Strings, example:
char c = 'a';
String s = "hello";
+ 1
Q = char
Question = string
the simple ex for meaning of char and string