+ 6
Does it always use capital 'S' for string?
11 ответов
+ 15
In Java, String is a class. That is its S needs to be in capital letter
+ 11
In Java? Yes. Only primitive data types are written in all lower-case, like int and double. You can think of String as a class that handles char data types.
+ 7
Just to add to Jukka's answer - by convention all Java classes begin with an uppercase letter, and String is indeed a class
+ 5
thank you for your answer Jukka Kuusto
+ 4
Right! And Classes are essentially non-primitive data types :)
+ 4
Exactly. Fun fact: primitive data types have corresponding, pre-defined classes, like Integer and Double. You need them when assigning types to collections and maps.
Example: Map<String, Integer>
You couldn't assign a primitive data type, like this: Map<String, int>
Java would throw an error if you tried.
+ 2
Even the void keyword has an associated class :) with reflection you can actually created a Void instance, though this is quite useless
+ 2
All java class begin with uppercase letter( large or capital letter), and String is a class, So uses capital S.
+ 2
In java programming language String is class.
So 'S' is required for string.
+ 2
Depends on the language. For example in C# "string" and "String" mean the same thing.
0
No, it doesn't use capital 'S' in c++ programming language for string.