It is a very interesting question for any software developer and it is very challenging for developers.
Here we define both string and String like:
After executing this program getval contains: Amit
We can see below:
And getname also contain: Amit
We can also see below:
And
Getval and getname contain the same methods like:
Aggregate<>
Any<>
All<>
……
…..
Etc.
Now we come to our topic, that is,what is the difference between both (String and string)? After completing the execution of this program when we mouse over on string is shows class System.String and whenwe mouse over on String it also shows Class System.String. Class System.String statement clarifying that string is the alias name of String.
Conclusion:
String is the alias name of String because both contain the same things which you saw above.