Wondering if compared to C#, java's final is more similar to which? const or readonly?
In the C Programming Language, the strcmp function returns a negative, zero, or positive integer depending on whether the object pointed to by s1 is less than, equal to, or greater than the object pointed to by s2.
You can't compare strings in C with ==, because the C compiler does not really have a clue about strings beyond a string-literal.
We compare the strings by using the strcmp() function, i.e., strcmp(str1,str2). This function will compare both the strings str1 and str2. If the function returns 0 value means that both the strings are same, otherwise the strings are not equal.
The strcmp() function, is used to compare the strings (str1,str2). The strings str1 and str2 will be compared using this function. If the function returns a value 0, it signifies that the strings are equal otherwise, strings are not equal.
Interesting question,
Java's final
keyword implies a few things:
C#'s readonly
keyword applies basically the same restrictions.
For completeness - let's look at const
:
So -- I'd say final is more similar to readonly.
-- Dan
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With