1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
artcher [175]
2 years ago
12

The following method public String removeFromString(String old, String frag) removes all occurences of the string frag from the

string old. For example, removeFromString("hello there!", "he") returns "llo tre!" removeFromString("lalalala", "l") returns "aaaa" Which of the following blocks of code will successfully implement removeFromString()?
Computers and Technology
1 answer:
Mashutka [201]2 years ago
4 0

private static String removeFromString(String old, String frag)

{

int i = old.indexOf(frag);

while (i> -1) {

String rest = old.substring(i + frag.length());

System.out.println("rest = " + rest);

old = old.substring(0, i);

System.out.println("rest = " + old);

old = old + rest;

System.out.println("rest = " + old);

i = old.indexOf(frag);

System.out.println("i = "+ i);

}

return old;

}

Here the index of first occurrence is obtained outside the “while loop” and if this loop runs until index value is >-1. It extracts the rest of the characters other than “frag” from the index and all the characters for which the given set of characters are removed.

You might be interested in
Joseph wants to take out the color of the background wall from an image what can Joseph do to achieve this​
snow_lady [41]

Answer:

Go to remove a background website

Explanation:

6 0
2 years ago
Read 2 more answers
Which invention provided instant communication and information to a massive audience for the first time?
igor_vitrenko [27]
B. Television. It provided <span>instant communication and information to a massive audience for the first time in 1927.

Hope this helps :)</span>
4 0
2 years ago
Read 2 more answers
Determine the output of the following code segment:
Nataly [62]

Answer:

The output to the given code as follows:

Output:

10

100

64

36

16

4

0

4

16

36

64

Explanation:

In the given java code, an integer variable "i" and an array number is defined, which size is 10, in the next step two for loop is declared, that can be described as follows:

  • In the first loop, array use loop variable "i" use, which minus the value of 5 and multiplies by 2, and it will calculate the square of that number.
  • In the next step, a for loop is declared, that prints these array number variable square.
7 0
3 years ago
In an advertisement, a speed specification, such as 2.66 ghz, indicates the speed of the microprocessor?
Ray Of Light [21]

Answer:

yes / true

Explanation:

it is one of the factors in determining the speed of the microprocessor

5 0
1 year ago
Why star topology is more reliable than bus or ring topologies
Valentin [98]

Answer:

<h3><em><u>simple </u></em><em><u>ans</u></em></h3>

Explanation:

<h2><em><u>it </u></em><em><u>is </u></em><em><u>because </u></em><em><u>as </u></em><em><u>it </u></em><em><u>has </u></em><em><u>server </u></em><em><u>computer </u></em><em><u>and </u></em><em><u>no </u></em><em><u>one </u></em><em><u>are </u></em><em><u>free </u></em><em><u>as </u></em><em><u>other </u></em><em><u>topology </u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em></h2>

<h2><em><u>client </u></em><em><u>computer </u></em><em><u>should </u></em><em><u>ask </u></em><em><u>server </u></em><em><u>to </u></em><em><u>share </u></em><em><u>any </u></em><em><u>information </u></em><em><u>ideas </u></em><em><u>etc.</u></em></h2>

<em><u>this </u></em><em><u>much.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em>

<h2><em><u>follow</u></em></h2>
8 0
1 year ago
Read 2 more answers
Other questions:
  • All digital images are made up from varying rectangles of color, called _____________.
    6·2 answers
  • The traditional UNIX scheduler enforces an inverse relationship between priority numbers and priorities: the higher the numbe1~
    6·1 answer
  • _____ can render data useless to unauthorized users who might have violated some of the database security layers.
    7·1 answer
  • When a client computer wants to connect to a service instance, what specific name type does it use to find the service?
    9·1 answer
  • This method of advertising is expensive but can be the most effective method.
    15·1 answer
  • What application service allows you to decouple your infrastructure using messaged based queues?
    10·1 answer
  • A _________ is a component commonly used in an analog pressure gauge. Use letter keys to select choices A microprocessor B press
    8·1 answer
  • Compress<br> 00eb:0000:0000:0000:d8c1:0946:0272:879<br> IPV6 Address
    9·1 answer
  • How to hack a I'd Indian brainly bot​
    7·1 answer
  • suppose one packet switches between a sending host and a receiving host. the transmission rates between the sending host and the
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!