Q. What will be the output of the following program?
public class Test{
public static void main(String args[]){
String str1 = "one";
String str2 = "two";
System.out.println(str1.concat(str2));
}
}

  • (A) one
  • (B) two
  • (C) onetwo
  • (D) onetwo D. twoone
πŸ’¬ Discuss
βœ… Correct Answer: (C) onetwo
Explanation: Concat() method appends one String to the end of another. The method returns a String with the value of the String passed into the method appended to the end of the String which is used to invoke this method.
Explanation by: Vikash Gupta
Concat() method appends one String to the end of another. The method returns a String with the value of the String passed into the method appended to the end of the String which is used to invoke this method.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
247
Total Visits
πŸ“½οΈ
2 y ago
Published
πŸŽ–οΈ
Vikash Gupta
Publisher
πŸ“ˆ
80%
Success Rate