English

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

Advertisements
Advertisements

Questions

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

Differentiate between isUpperCase() and toUpperCase().

Distinguish Between
Advertisements

Solution 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. 

shaalaa.com

Solution 2

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
  Is there an error in this question or solution?
Chapter 2: Library Classes - EXERCISES [Page 179]

APPEARS IN

Avichal Computer Applications [English] Class 10 ICSE
Chapter 2 Library Classes
EXERCISES | Q VII. 4. (a) | Page 179
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×