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

James has 16 balloons 1/4 of his balloons are red how many red balloons does he have?
Which inequality represents all values of x for which the product below is defined? √5x ·√x+4 a.x>0 b.x≥0 c.x≤-4 d.x≥-4
what is the full form of ATP Can you help me pls
Name the organelle of plant cells in which photosynthesis occurs
Name the organelle of plant cells in which photosynthesis occurs
why a c is advantageable than dc
A 50 METER PATH SURROUNDS A RECTANGULAR GARDEN. THE WIDTH OF THE GARDEN IS TWO-THIRDS ITS LENGTH. FIND ITS AREA.
when resistors are connecting in a series ,does the position of ammeter make any difference ?
if it is 10;25 p.m. what time was it 11 hours and 55 minutes before that?
Find the distance between the pair of parallel lines, y = -2x+1 & y = -2x+16.
good job