Which is the most efficient way to concatenate the two strings, "quick brown fox" and "jumped over the lazy dog" in Java?

A. String string1 = "quick brown fox";
string1 = string1 + " jumped over the lazy dog";
B. String string1 = "quick brown fox";
String string2 = string1 + " jumped over the lazy dog";
C. String string1 = "quick brown fox";
String string2 =" jumped over the lazy dog";
String string3 = string1 + string2;
D. StringBuffer buffer = new StringBuffer("quick brown fox");
buffer.append(" jumped over the lazy dog");
String string1 = buffer.toString();


Answer: D

Computer Science & Information Technology

You might also like to view...

Network devices are tempting targets because they are ____.

A. concentrated B. dispersed C. unprotected D. easily carried

Computer Science & Information Technology

Which of the following statements is false?

a. Primitive types are keywords. b. Primitive types must appear in all lowercase letters. c. Real numbers contain decimal points. d. Variable name identifiers must begin with a lowercase letter.

Computer Science & Information Technology

A button fires events know as:

a. static events b. passive events c. dynamic events d. action events

Computer Science & Information Technology

What is the purpose of rasterizing type, and how is it done? What is its main drawback? What is it's main benefit?

What will be an ideal response?

Computer Science & Information Technology