Questions and Answers
Which constructor in the String class creates an empty string?
String str = new String();
What is the purpose of the String constructor String(byte[] bytes)?
To create a new String by decoding the specified array of bytes using the platform's default charset.
Which constructor is used to create a String object with the same sequence of characters as a specified StringBuffer?
String str = buffer.toString();
Which constructor creates an empty string?
Signup and view all the answers
Which constructor creates a string with the specified content?
Signup and view all the answers
Which constructor creates a string with the same content as the given StringBuffer object?
Signup and view all the answers