Can anyone tell the Difference between Empty String and Null String

Recommended Answers

All 4 Replies

String myString1 = null; // null string
String myString2 = ""; // Empty string

In the first case, there is no object assigned to the string. You can't call any of the string methods on it.

In the second case, there is an object, it just contains nothing.

Thanks Momerath for giving your valuable time

//empty sting is
char string[]="";
char string[11]; // in the end of this string there is a room for null character which is \0.

for more on strings in c++ go to
<<spam URL>>

Too bad this is C# and not C++.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.