71. What will s2 contain after following lines of Java code?
StringBuffer s1 = "one";
StringBuffer s2 = s1.append("two")
StringBuffer s1 = "one";
StringBuffer s2 = s1.append("two")
72. Which of this method of class StringBuffer is used to concatenate the string representation to the end of invoking string?
73. What is the value returned by function compareTo() if the invoking string is less than the string compared?
74. What is the value returned by function compareTo() if the invoking string is greater than the string compared?
75. What will be the output of the following Java program?
class String_demo
{
public static void main(String args[])
{
char chars[] = {'a', 'b', 'c'};
String s = new String(chars);
System.out.println(s);
}
}
class String_demo
{
public static void main(String args[])
{
char chars[] = {'a', 'b', 'c'};
String s = new String(chars);
System.out.println(s);
}
}
76. Which of this method of class StringBuffer is used to get the length of the sequence of characters?
77. Which of these method of class String is used to extract a single character from a String object?
78. What will be the output of the following Java program?
class output
{
public static void main(String args[])
{
String s1 = "one";
String s2 = s1 + " two";
System.out.println(s2);
}
}
class output
{
public static void main(String args[])
{
String s1 = "one";
String s2 = s1 + " two";
System.out.println(s2);
}
}
79. Which of this method of class String is used to extract a substring from a String object?
80. Which of these method of class String is used to extract more than one character at a time a String object?
Read More Section(Strings)
Each Section contains maximum 100 MCQs question on Strings. To get more questions visit other sections.