Vidyalelo
Java Programming · Q91

Strings

Programming · Java Programming · question 91

Q91

What will be the output of the following Java code? class output public static void main(String args[]) String chars[] = "a", "b", "c", "a", "c"; for (int i = 0; i < chars.length; ++i) for (int j = i + 1; j < chars.length; ++j) if(chars[i].compareTo(chars[j]) == 0) System.out.print(chars[j]);

A.
ab
B.
bc
C.
ca
D.
ac
Answer

Answer: Option D

Solution

Answer: Option D
No explanation is given for this question Let's Discuss on Board