JAVA Programming :: Objects and Classes - Discussion
Home > JAVA Programming > Objects and Classes > MCQs Questions Discussion
21 / 30
Choose the correct option.
What is the output for the below code?
import javutil.LinkedList;
import javutil.Queue;
public class Test {
public static void main(String... args) {
Queue q = new LinkedList();
q.add("newyork");
q.add("ca");
q.add("texas");
show(q);
}
public static void show(Queue q) {
q.add(new Integer(1);
while (!q.isEmpty ( ) )
System.out.print(q.poll() + " ");
}
}
ACompile error : Integer can't add
Bnewyork ca texas 11
Cnewyork ca texas
DNone of the above
Answer: Option (Login/Signup)
Show Explanation
Asked In ::
No Discussion on this question yet!