Computer Applications
When the String m is compared to n, the result obtained is greater than zero. Which of the following is true?
mcomes before n in the dictionary.ncomes beforemin the dictionary.mandnare equal.mandnhave the same length.
Java String Handling
2 Likes
Answer
n comes before m in the dictionary.
Reason — If comparing string m to n results in a value greater than zero, it means m is lexicographically greater than n. Hence, n comes before m in the dictionary.
Answered By
1 Like
Related Questions
Raj wanted to count the number of digits in a given number without using a loop. Which of the following statements is correct to perform the above?
- String.valueOf(n).length()
- Integer.parseInt(n).length()
- n.length()
- All the above
Sham was asked to encode a string S, by replacing the letter E with #. Select the appropriate statement:
- S.replace('#','E')
- S.replace('E')
- S.replace('E', '#')
- S.replace('#')
Which of the following String methods has integer argument?
(i) length
(ii) substring
(iii) indexOf
(iv) charAt- Only (ii)
- (i) and (iv)
- (ii) and (iv)
- (iii) and (iii)
Assertion: Property by virtue of which one class acquires the properties of another class is termed as Inheritance.
Reason: Inheritance promotes reusability.
- Assertion is true, Reason is false.
- Assertion is true, Reason is true.
- Assertion is false, Reason is false.
- Assertion is false, Reason is true.