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.
उत्तर २
| 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:
|
Syntax:
|
| 4. | Example:
|
Example:
|
APPEARS IN
संबंधित प्रश्न
Differentiate between if else if and switch-case statements.
Give the output of the following code:
String P = “20”, Q = “19”,
int a = Integer .parselnt(P);
int b = Integer. valueOf(Q);
System.out.println(a+””+b);
int res = ‘A’;
What is the value of res?
Write a program to accept a number and check and display whether it is a Niven number or not.
(Niven number is that number which is divisible by its sum of digits).
Example:
Consider the number 126.
The Sum of its digits is 1+2+6 = 9 and 126 is divisible by 9.
State one difference between the floating point literals float and double.
What will be the output when the following code segment is executed?
String s = “1001”;
int x = Integer. valueOf(s);
double y = Double.valueOf(s);
System.out.println(“x=”+x);
System.out.println(“y=”+y);
Give the output of the following Character class method:
Character.toUpperCase('a')Give the output of the following Character class method:
Character.isLetterOrDigit('W')What is the method to check whether a character is a letter or digit?
Define a class to accept a string and convert the same to uppercase, create and display the new string by replacing each vowel by immediate next character and every consonant by the previous character. The other characters remain the same.
Example: Input: #IMAGINATION@2024
Output: #JLBFJMBSJPM@2024
