Question ID :955242516420 in JQ+
import java.awt.*;
public class TestClass extends Frame
{
Button b = new Button("OK");
TestClass()
{
add("South", b);
b.addActionListener( new MyListener("one") );
b.addActionListener( new MyListener("two") );
b.addActionListener( new MyListener("three") );
this.setSize(400, 400);
b.setVisible(true);
this.getLayout().layoutContainer(this);
this.setVisible(true);
}
public static void main(
String[ ] args)
{
new TestClass();
}
class MyListener implements ActionListener
{
String name = "";
public MyListener(String str) { this.name = str; }
public void actionPerformed(ActionEvent ae)
{
System.out.println(name);
}
}
}
there were two options :
1. It will Print one two three but in an Unknown Order.
2. It will Print one two three in that Order.
The Correct Answer is 1 According to JQ+
But According to me Its Should be 2
Thanks in Advance
Navi