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(); // compilesStringBuilder 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.