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);
State the data type and value of res after the following is executed :
char ch = ‘9’;
res = Character. isDigit(ch)
Write the return data type of the following function:
log( )
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 code.
String A = "26.0", B= "74.0";
double C = Double.parseDouble(A);
double D = Double.parseDouble(B);
System.out.println((C+D));
Predict the output of the following code snippet: String P = "20", Q = "22";
int a = Integer.parseInt(P);
int b = Integer.value0f(Q);
System.out.println(a + " " + b);
Give the output of the following Character class method:
Character.toUpperCase('a')Write the value of n after execution:
char ch = 'd';
int n = ch + 5;A student is trying to convert the string present in x to a numerical value, so that he can find the square root of the converted value, However the code has an error. Name the error (syntax/logical/runtime). Correct the code so that it compiles and runs correctly.
String x="25";
int y=Double.parseDouble(x);
double r=Math.sqrt(y);
System.out.println(r);