1.

What is the output of this program?

public class Result
{
public static void main(String args[])
{
String ch[] = {"p", "q", "p", "s", "t"};
for (int K = 0; K < ch.length; ++K)
for (int L = K + 1; L < ch.length; ++L)
if(ch[K].compareTo(ch[L]) == 0)
System.out.print(ch[L]);
}
}

A. p
B. q
C. r
D. s
E. t
Answer» B. q


Discussion

No Comment Found

Related MCQs