QUESTION 5 Which of the following creates the string of the numbers from 1 to 1000 most efficiently? a. StringBuilder sb = new StringBuilder(10); for (int i = 1; i


JAVA


QUESTION 5<br>Which of the following creates the string of the numbers from 1 to 1000 most efficiently?<br>a. StringBuilder sb = new StringBuilder(10);<br>for (int i = 1; i <= 1000; i++)<br>sb.append(i);<br>String s = new String(sb);<br>b. All are equivalently efficient.<br>C. StringBuilder sb = new StringBuilder(3000);<br>for(int i = 1; i <= 1000; i++)<br>{<br>sb.append(i);<br>}//END for i from 1 thru 1000<br>String s = new String(sb);<br>d. String s;<br>for (int i = 1; i<= 1000; i++)<br>s += i;<br>

Extracted text: QUESTION 5 Which of the following creates the string of the numbers from 1 to 1000 most efficiently? a. StringBuilder sb = new StringBuilder(10); for (int i = 1; i <= 1000;="" i++)="" sb.append(i);="" string="" s="new" string(sb);="" b.="" all="" are="" equivalently="" efficient.="" c.="" stringbuilder="" sb="new" stringbuilder(3000);="" for(int="" i="1;" i=""><= 1000;="" i++)="" {="" sb.append(i);="" }//end="" for="" i="" from="" 1="" thru="" 1000="" string="" s="new" string(sb);="" d.="" string="" s;="" for="" (int="" i="1;"><= 1000;="" i++)="" s="" +="">

Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here