21.  Which of these method of class String is used to remove leading and trailing whitespaces ?


startsWith()
trim()
Trim()
doTrim()


Answer

 Option

No answer description available for this question.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report

22.  Which of these is an correct statement ?


String objects are immutable, they cannot be changed.
String object can point to some other reference of String variable.
StringBuffer class is used to store string in a buffer for later use.
None of the mentioned


Answer

 Option

StringBuffer class is used to create strings that can be modified after they are created.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report

23.  Which of these constructors is used to create an empty String object ?


String()
String(void)
String(0)
None of the mentioned


Answer

 Option

No answer description available for this question.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report

24.  Which of these method of class String is used to extract a substring from a String object ?


substring()
Substring()
SubString()
None of the mentioned


Answer

 Option

No answer description available for this question.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report

25.  What is the output of this program ?
class output {
public static void main(String args[])
{
String c = ‘‘Hello i love java’‘;
boolean var;
var = c.startsWith(‘‘hello’‘);
System.out.println(var);
}
}


true
false
0.
1


Answer

 Option

startsWith() method is case sensitive ‘‘hello’‘ and ‘‘Hello’‘ are treated differently, hence false is stored in var.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report