Given the code fragment: String name = "Spot"; int age = 4; String str ="My dog " + name + " is " + age;

By | January 7, 2023

Given the code fragment:
String name = “Spot”;
int age = 4;
String str =”My dog ” + name + ” is ” + age;
System.out.println(str);
And
StringBuilder sb = new StringBuilder();
Using StringBuilder, which code fragment is the best potion to build and print the following
string My dog Spot is 4

Correct Answer: A,C