हिंदी

Give the output of the following String class method: "COMMENCEMENT".lastIndex0f('M') - Computer Applications

Advertisements
Advertisements

प्रश्न

Give the output of the following String class method:

"COMMENCEMENT".lastIndexOf('M')
संक्षेप में उत्तर
Advertisements

उत्तर

8

Explanation:

The lastIndexOf('M') returns the index of the last occurrence of 'M' in the string.

shaalaa.com
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
2022-2023 (March) Official

संबंधित प्रश्न

Write the return data type of the following function:

endsWith( )


Write a program to initialize the seven Wonders of the World along with their locations in two different arrays. Search for the name of the country input by the user. If found, display the name of the country along with its Wonder, otherwise display “Sorry Not Found!”. 
Seven wonders — CHICHEN ITZA, CHRIST THE REDEEMER, TAJMAHAL, GREAT WALL OF CHINA, MACHU PICCHU, PETRA, COLOSSEUM
Locations — MEXICO, BRAZIL, INDIA, CHINA, PERU, JORDAN, ITALY
Example

Country Name: INDIA     Output: INDIA-TAJMAHAL
Country Name: USA        Output: Sorry Not Found!


The String class method to join two strings is ______.


The output of the function "COMPOSITION". substring(3, 6):


Give the output of the following String class method:

"devote". compareTo("DEVOTE")

int x = 98; char ch = (char)x; what is the value in ch?


The output of the statement "CONCENTRATION" indexOf('T') is ______.


The output of the statement "talent". compareTo("genius") is ______.


The following code to compare two strings is compiled, the following syntax error was displayed - incompatible types - int cannot be converted to boolean.

Identify the statement which has the error and write the correct statement. Give the output of the program segment.

void calculate()
  {
  String a="KING",b="KINGDOM";
  boolean x=a.compareTo(b);
  system.out.println(x);
  }

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));

Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×