0

i want to know the different between char and string?

in java se i have a problem that i cant when use the char or string as a variable

16th Jun 2022, 5:40 PM
Mody Ahmed
Mody Ahmed - avatar
4 Answers
0
Nice. Also bear in mind in Java char is a primitive type while String (notice the uppercase S here) is an object, with all the consequences this difference has in Java programming language. 😉 Just to mention one of these 50 differences or so... because a String is an object in Java, it's highly advisable you compare two Strings for equality with equals() method instead of the equality operator ==, like in this boolean expression: someString.equals(otherString)
18th Jun 2022, 3:25 PM
Alejandro M GonzĂĄlez
Alejandro M GonzĂĄlez - avatar
+ 4
A char is a single character, a string is an array of characters, so it has to have more than one. A string is technically a data structure while also being a primitive data type. Also, please know that Java and Javascript are two very different languages so please be specific on which one you mean if you need help with specific code.
16th Jun 2022, 5:44 PM
Justice
Justice - avatar
0
Thank you
17th Jun 2022, 5:21 AM
Mody Ahmed
Mody Ahmed - avatar