मराठी

Given that: String gk = "James Clerk Maxwell"; nk = gk.compareTolgnoreCase("k"); What will be the value of nk?

Advertisements
Advertisements

प्रश्न

Given that:

String gk = "James Clerk Maxwell";

nk = gk.compareTolgnoreCase("k");

What will be the value of nk?

पर्याय

  • 1

  • 2

  • −1

  • −2

MCQ
Advertisements

उत्तर

−1

Explanation:

The compareToIgnoreCase() method compares the very first characters of both strings alphabetically after converting them to lowercase. Since 'j' (from "James") comes exactly one position before 'k' in the alphabet, the method performs the subtraction ('j' 'k'), which equals 1.
shaalaa.com
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 10: String Handling - Exercises [पृष्ठ २४५]

APPEARS IN

रूपा पंडित Computer Applications [English] Class 10 ICSE
पाठ 10 String Handling
Exercises | Q 1. (viii) | पृष्ठ २४५
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×