Sail E0 Webinar
Question


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);
}
}
Options:
A .  3 0
B .  0 3
C .  3 4
D .  4 3
Answer: Option D

None.
output:
$ javac String_demo.java
$ java String_demo
4 3



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers