1.  What is the output of this program ?
class A {
int i;
int j;
A() {
i = 1;
j = 2;
}
}
class Output {
public static void main(String args[])
{
A obj1 = new A();
System.out.print(obj1.toString());
}
}


true
false
String associated with obj1
compilation error


Answer

 Option

No answer description available for this question.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report

2.  What is the output of this program ?
class String_demo {
public static void main(String args[])
{
char chars[] = {'a', 'b', 'c'};
String s = new String(chars);
String s1 = ‘‘abcd’‘;
int len1 = s1.length();
int len2 = s.length();
System.out.println(len1 + ‘‘ ‘‘ + len2);
}
}


3 0
0 3
3 4
4 3


Answer

 Option

No answer description available for this question.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report

3.  What is the output of this program ?
class String_demo {
public static void main(String args[])
{
int ascii[] = { 65, 66, 67, 68};
String s = new String(ascii, 1, 3);
System.out.println(s);
}
}


ABC
BCD
CDA
ABCD


Answer

 Option

No answer description available for this question.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report

4.  What is the output of this program ?
class String_demo {
public static void main(String args[])
{
char chars[] = {'a', 'b', 'c'};
String s = new String(chars);
System.out.println(s);
}
}


a
b
c
abc


Answer

 Option

No answer description available for this question.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report

5.  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