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
4 ответов
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)
+ 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.
0
Thank you