Example (note the case):
string s = \"Hello world!\";
String s = \"Hello world!\";
What are
string
is a reserved word, but String
is just a class name.
This means that string
cannot be used as a variable name by itself.
If for some reason you wanted a variable called string, you'd see only the first of these compiles:
StringBuilder String = new StringBuilder(); // compiles
StringBuilder string = new StringBuilder(); // doesn't compile
If you really want a variable name called string you can use @
as a prefix:
StringBuilder @string = new StringBuilder();
Another critical difference: Stack Overflow highlights them differently.