हिंदी

Write a difference between the functions isUpperCase() and toUpperCase(). - Computer Applications

Advertisements
Advertisements

प्रश्न

Write a difference between the functions isUpperCase() and toUpperCase().

Differentiate between isUpperCase() and toUpperCase().

अंतर स्पष्ट करें
Advertisements

उत्तर १

The isuppercase() method is used to check whether the given character is in upper case or not. It returns a Boolean data type.

The toUpperCase() method is used to convert a character or string into upper case. It returns char or String type. 

shaalaa.com

उत्तर २

Sr. No. isUpperCase() toUpperCase()
1. The isuppercase() method is used to check whether the given character is in upper case or not. It returns a Boolean data type. The toUpperCase( ) method is used to convert a character or string into upper case. It returns char or String type.
2. This function returns true if the parameter is an uppercase letter, and false otherwise. This function returns the supplied argument in uppercase characters. If a character is already in uppercase, it remains unchanged. If the supplied character is not a letter, it will be returned as is.
3. Syntax: 
boolean isUpperCase = Character.isUpperCase(characterVariable);
Syntax:
char uppercaseChar = Character.toUpperCase(characterVariable);
4. Example:
boolean p = Character.isUpperCase('c'); // returns false 
Example:
char p = Character.toUpperCase('y'); // returns Y
char p = Character.toUpperCase('Y’); // returns Y
char p = Character.toUpperCase('?'); // returns ?
shaalaa.com
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 2: Library Classes - EXERCISES [पृष्ठ १७९]

APPEARS IN

अविचल Computer Applications [English] Class 10 ICSE
अध्याय 2 Library Classes
EXERCISES | Q VII. 4. (a) | पृष्ठ १७९
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×