amorrison6849 amorrison6849
  • 07-08-2019
  • Computers and Technology
contestada

What method of the String object searches the string for an occurence of the specified search string?


the charAt() method

the search() method

the indexOf() method

the substring() method

Respuesta :

ExieFansler ExieFansler
  • 13-08-2019

Answer:

the indexOf() method

Explanation:

The indexOf() method in java returns the first occurrence of the of the string or a character specified in it.It can be used to search both a character or a string.

for example:-

import java.util.*;

import java.lang.*;

import java.io.*;

class indexOf

{

public static void main (String[] args)

{

    String s="IamNumber4";

    int l=s.indexOf("Num");//using indexOf() method on string object..

    System.out.println(l);

}

}

Output:-

3

Answer Link

Otras preguntas

What part of a microscope helps and adjust the brightness of an image
A student plans to transfer from a college that uses the quarter system to a college that uses the semester system. The number of semester hours a student recei
what is the unit rate of: 4 pounds of apples cost $1.96
how do you do something like this? (8/10)^-2
The Indian subcontinent was partitioned into _____. A)Bangladesh and Tibet B)Tibet and Pakistan C)Pakistan and India D)India and Bangladesh
To establish the reliability and credibility of a secondary source, you must know which of the following? A. Information about the topic of the source, includin
What is 1/5 in decimal form
ll of the belligerents in the Crimean War
How do you use benchmark to estimate 2.81 + 3.72
5x+4y=36 explain it to me