Advertisements
Advertisements
प्रश्न
Consider the array given below:
char ch[]={'A','E','I','O','U'};
Write the output of the following statements:
System.out.println(ch[0]*2);;विकल्प
65
130
'A'
0
Advertisements
उत्तर
130
Explanation:
- In Java, characters are represented using their ASCII values.
- The ASCII value of 'A' is 65. When ch[0]*2 is executed, it multiplies the ASCII value of 'A' (which is 65) by 2, resulting in 130.
APPEARS IN
संबंधित प्रश्न
Write the return data type of the following function:
endsWith( )
Define a class to accept two strings, convert them into uppercase, check and display whether two strings are equal or not, if the two strings are not equal, print the string with the highest length or print the message both the strings are of equal length.
Define a class to accept a string, convert it into lowercase and check whether the string is a palindrome or not.
A palindrome is a word that reads the same backward as forward.
Example:
madam, racecar etc.
The String class method to join two strings is ______.
Give the output of the following String class method:
"COMMENCEMENT".lastIndexOf('M')Give the output of the following String class method:
"devote". compareTo("DEVOTE")Define a class to accept a String and print the number of digits, alphabets and special characters in the string.
| Example: | S = "KAPILDEV@83" |
| Output: | Number of digits - 2 ' Number of Alphabets - 8 Number of Special characters - 1 |
int x = 98; char ch = (char)x; what is the value in ch?
The output of the statement "talent". compareTo("genius") is ______.
Write the output of the following String methods:
String x="Galaxy",y="Games";
(a) System.out.println(x.charAt(0)==y.charAt(0));
(b) System.out.println(x.compareTo(y));